diff --git a/Cargo.toml b/Cargo.toml index 4009c1687..5f21a8803 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,8 @@ v1_26 = [] v1_27 = [] v1_28 = [] v1_29 = [] -latest = ["v1_29"] +v1_30 = [] +latest = ["v1_30"] # Enable `schemars::JsonSchema` implementations on resource types. schemars = ["dep:schemars"] diff --git a/build.rs b/build.rs index 98a0deb6f..1c612a0c0 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,7 @@ fn main() -> Result<(), Box> { use std::io::Write; const MIN: usize = 24; - const MAX: usize = 29; + const MAX: usize = 30; println!("cargo:rerun-if-env-changed=K8S_OPENAPI_ENABLED_VERSION"); diff --git a/devenv.sh b/devenv.sh index 32e0d5231..a331764b4 100755 --- a/devenv.sh +++ b/devenv.sh @@ -3,7 +3,7 @@ set -euo pipefail session_name='k8s-openapi' -max_version='1.29' +max_version='1.30' if ! tmux has-session -t "=$session_name"; then cd "$(dirname "$0")" diff --git a/k8s-openapi-codegen/src/fixups/upstream_bugs.rs b/k8s-openapi-codegen/src/fixups/upstream_bugs.rs index 94bedee50..0d3ea2a2a 100644 --- a/k8s-openapi-codegen/src/fixups/upstream_bugs.rs +++ b/k8s-openapi-codegen/src/fixups/upstream_bugs.rs @@ -159,6 +159,40 @@ pub(crate) mod required_properties { Err("never applied admissionregistration.k8s.io/v1beta1.ValidatingAdmissionPolicyList required properties override".into()) } + + // `ValidatingAdmissionPolicyBindingList::items` + pub(crate) fn validating_admission_policy_binding_list(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { + let definition_path = crate::swagger20::DefinitionPath("io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyBindingList".to_owned()); + if let Some(definition) = spec.definitions.get_mut(&definition_path) { + if let crate::swagger20::SchemaKind::Properties(properties) = &mut definition.kind { + if let Some(property) = properties.get_mut("items") { + if !property.1 { + property.1 = true; + return Ok(()); + } + } + } + } + + Err("never applied admissionregistration.k8s.io/v1.ValidatingAdmissionPolicyBindingList required properties override".into()) + } + + // `ValidatingAdmissionPolicyList::items` + pub(crate) fn validating_admission_policy_list(spec: &mut crate::swagger20::Spec) -> Result<(), crate::Error> { + let definition_path = crate::swagger20::DefinitionPath("io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyList".to_owned()); + if let Some(definition) = spec.definitions.get_mut(&definition_path) { + if let crate::swagger20::SchemaKind::Properties(properties) = &mut definition.kind { + if let Some(property) = properties.get_mut("items") { + if !property.1 { + property.1 = true; + return Ok(()); + } + } + } + } + + Err("never applied admissionregistration.k8s.io/v1.ValidatingAdmissionPolicyList required properties override".into()) + } } // `Status` has extra group-version-kind entries than the original `"":v1:Status` that cause it to not be detected as a `Resource`. diff --git a/k8s-openapi-codegen/src/supported_version.rs b/k8s-openapi-codegen/src/supported_version.rs index 6d3910aa6..6d0b927ab 100644 --- a/k8s-openapi-codegen/src/supported_version.rs +++ b/k8s-openapi-codegen/src/supported_version.rs @@ -5,6 +5,7 @@ pub(crate) const ALL: &[SupportedVersion] = &[ SupportedVersion::V1_27, SupportedVersion::V1_28, SupportedVersion::V1_29, + SupportedVersion::V1_30, ]; #[derive(Clone, Copy, Debug)] @@ -15,6 +16,7 @@ pub(crate) enum SupportedVersion { V1_27, V1_28, V1_29, + V1_30, } impl SupportedVersion { @@ -26,6 +28,7 @@ impl SupportedVersion { SupportedVersion::V1_27 => "1.27", SupportedVersion::V1_28 => "1.28", SupportedVersion::V1_29 => "1.29", + SupportedVersion::V1_30 => "1.30", } } @@ -37,6 +40,7 @@ impl SupportedVersion { SupportedVersion::V1_27 => "v1_27", SupportedVersion::V1_28 => "v1_28", SupportedVersion::V1_29 => "v1_29", + SupportedVersion::V1_30 => "v1_30", } } @@ -48,6 +52,7 @@ impl SupportedVersion { SupportedVersion::V1_27 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.27.13/api/openapi-spec/swagger.json", SupportedVersion::V1_28 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.28.9/api/openapi-spec/swagger.json", SupportedVersion::V1_29 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.29.4/api/openapi-spec/swagger.json", + SupportedVersion::V1_30 => "https://raw.githubusercontent.com/kubernetes/kubernetes/v1.30.0/api/openapi-spec/swagger.json", } } @@ -105,6 +110,18 @@ impl SupportedVersion { crate::fixups::upstream_bugs::required_properties::beta1_validating_admission_policy_list, crate::fixups::upstream_bugs::status_extra_gvk, ], + + SupportedVersion::V1_30 => &[ + crate::fixups::upstream_bugs::connect_options_gvk, + crate::fixups::upstream_bugs::optional_properties::eventsv1_event, + crate::fixups::upstream_bugs::required_properties::alpha1_validating_admission_policy_binding_list, + crate::fixups::upstream_bugs::required_properties::alpha1_validating_admission_policy_list, + crate::fixups::upstream_bugs::required_properties::beta1_validating_admission_policy_binding_list, + crate::fixups::upstream_bugs::required_properties::beta1_validating_admission_policy_list, + crate::fixups::upstream_bugs::required_properties::validating_admission_policy_binding_list, + crate::fixups::upstream_bugs::required_properties::validating_admission_policy_list, + crate::fixups::upstream_bugs::status_extra_gvk, + ], }; let special_fixups = &[ diff --git a/k8s-openapi-tests-macro-deps/Cargo.toml b/k8s-openapi-tests-macro-deps/Cargo.toml index dd01432ad..c927a97f7 100644 --- a/k8s-openapi-tests-macro-deps/Cargo.toml +++ b/k8s-openapi-tests-macro-deps/Cargo.toml @@ -22,3 +22,4 @@ test_v1_26 = ["k8s-openapi/v1_26"] test_v1_27 = ["k8s-openapi/v1_27"] test_v1_28 = ["k8s-openapi/v1_28"] test_v1_29 = ["k8s-openapi/v1_29"] +test_v1_30 = ["k8s-openapi/v1_30"] diff --git a/k8s-openapi-tests/Cargo.toml b/k8s-openapi-tests/Cargo.toml index 6d65843a6..8a428117e 100644 --- a/k8s-openapi-tests/Cargo.toml +++ b/k8s-openapi-tests/Cargo.toml @@ -56,3 +56,4 @@ test_v1_26 = ["k8s-openapi/v1_26"] test_v1_27 = ["k8s-openapi/v1_27"] test_v1_28 = ["k8s-openapi/v1_28"] test_v1_29 = ["k8s-openapi/v1_29"] +test_v1_30 = ["k8s-openapi/v1_30"] diff --git a/k8s-openapi-tests/build.rs b/k8s-openapi-tests/build.rs index 12c726b83..8fcc120cf 100644 --- a/k8s-openapi-tests/build.rs +++ b/k8s-openapi-tests/build.rs @@ -4,7 +4,7 @@ fn main() { // Assert that the DEP_K8S_OPENAPI_*_VERSION is set by the k8s-openapi crate's build script correctly. const MIN: usize = 24; - const MAX: usize = 29; + const MAX: usize = 30; let enabled_version = { let mut enabled_versions = (MIN..=MAX).filter(|v| std::env::var(format!("CARGO_FEATURE_TEST_V1_{v}")).is_ok()); diff --git a/k8s-openapi-tests/cluster-configs/v1.30.yaml b/k8s-openapi-tests/cluster-configs/v1.30.yaml new file mode 100644 index 000000000..6459334d8 --- /dev/null +++ b/k8s-openapi-tests/cluster-configs/v1.30.yaml @@ -0,0 +1,4 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +featureGates: + WatchList: true diff --git a/k8s-openapi-tests/src/lib.rs b/k8s-openapi-tests/src/lib.rs index b22474b2e..3acea8062 100644 --- a/k8s-openapi-tests/src/lib.rs +++ b/k8s-openapi-tests/src/lib.rs @@ -51,6 +51,7 @@ impl Client { #[cfg(feature = "test_v1_27")] let replays_directory = "v1-27"; #[cfg(feature = "test_v1_28")] let replays_directory = "v1-28"; #[cfg(feature = "test_v1_29")] let replays_directory = "v1-29"; + #[cfg(feature = "test_v1_30")] let replays_directory = "v1-30"; let replays_directory = std::path::Path::new(concat!(env!("CARGO_MANIFEST_DIR"))) diff --git a/k8s-openapi-tests/test-replays/v1-30/api_versions-list.json b/k8s-openapi-tests/test-replays/v1-30/api_versions-list.json new file mode 100644 index 000000000..c3ab64837 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/api_versions-list.json @@ -0,0 +1,10 @@ +[ + { + "request_url": "/apis", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"APIGroupList\",\"apiVersion\":\"v1\",\"groups\":[{\"name\":\"apiregistration.k8s.io\",\"versions\":[{\"groupVersion\":\"apiregistration.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"apiregistration.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"apps\",\"versions\":[{\"groupVersion\":\"apps/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"apps/v1\",\"version\":\"v1\"}},{\"name\":\"events.k8s.io\",\"versions\":[{\"groupVersion\":\"events.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"events.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"authentication.k8s.io\",\"versions\":[{\"groupVersion\":\"authentication.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"authentication.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"authorization.k8s.io\",\"versions\":[{\"groupVersion\":\"authorization.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"authorization.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"autoscaling\",\"versions\":[{\"groupVersion\":\"autoscaling/v2\",\"version\":\"v2\"},{\"groupVersion\":\"autoscaling/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"autoscaling/v2\",\"version\":\"v2\"}},{\"name\":\"batch\",\"versions\":[{\"groupVersion\":\"batch/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"batch/v1\",\"version\":\"v1\"}},{\"name\":\"certificates.k8s.io\",\"versions\":[{\"groupVersion\":\"certificates.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"certificates.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"networking.k8s.io\",\"versions\":[{\"groupVersion\":\"networking.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"networking.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"policy\",\"versions\":[{\"groupVersion\":\"policy/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"policy/v1\",\"version\":\"v1\"}},{\"name\":\"rbac.authorization.k8s.io\",\"versions\":[{\"groupVersion\":\"rbac.authorization.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"rbac.authorization.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"storage.k8s.io\",\"versions\":[{\"groupVersion\":\"storage.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"storage.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"admissionregistration.k8s.io\",\"versions\":[{\"groupVersion\":\"admissionregistration.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"admissionregistration.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"apiextensions.k8s.io\",\"versions\":[{\"groupVersion\":\"apiextensions.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"apiextensions.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"scheduling.k8s.io\",\"versions\":[{\"groupVersion\":\"scheduling.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"scheduling.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"coordination.k8s.io\",\"versions\":[{\"groupVersion\":\"coordination.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"coordination.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"node.k8s.io\",\"versions\":[{\"groupVersion\":\"node.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"node.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"discovery.k8s.io\",\"versions\":[{\"groupVersion\":\"discovery.k8s.io/v1\",\"version\":\"v1\"}],\"preferredVersion\":{\"groupVersion\":\"discovery.k8s.io/v1\",\"version\":\"v1\"}},{\"name\":\"flowcontrol.apiserver.k8s.io\",\"versions\":[{\"groupVersion\":\"flowcontrol.apiserver.k8s.io/v1\",\"version\":\"v1\"},{\"groupVersion\":\"flowcontrol.apiserver.k8s.io/v1beta3\",\"version\":\"v1beta3\"}],\"preferredVersion\":{\"groupVersion\":\"flowcontrol.apiserver.k8s.io/v1\",\"version\":\"v1\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/custom_resource_definition-test.json b/k8s-openapi-tests/test-replays/v1-30/custom_resource_definition-test.json new file mode 100644 index 000000000..4fa76fbe5 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/custom_resource_definition-test.json @@ -0,0 +1,114 @@ +[ + { + "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"apiextensions.k8s.io/v1\",\"kind\":\"CustomResourceDefinition\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\"},\"spec\":{\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"names\":{\"kind\":\"FooBar\",\"plural\":\"foobars\",\"shortNames\":[\"fb\"],\"singular\":\"foobar\"},\"scope\":\"Namespaced\",\"versions\":[{\"name\":\"v1\",\"schema\":{\"openAPIV3Schema\":{\"properties\":{\"spec\":{\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"items\":{\"type\":\"boolean\"},\"type\":\"array\"},\"prop3\":{\"format\":\"int32\",\"type\":\"integer\"},\"prop4\":{\"x-kubernetes-int-or-string\":true}},\"required\":[\"prop1\",\"prop2\",\"prop4\"],\"type\":\"object\"}},\"type\":\"object\"}},\"served\":true,\"storage\":true,\"subresources\":{\"status\":{}}}]}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"28bb69f7-b200-447a-8d6e-e5b5c5a5c374\",\"resourceVersion\":\"559\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:conversion\":{\".\":{},\"f:strategy\":{}},\"f:group\":{},\"f:names\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:scope\":{},\"f:versions\":{}}}}]},\"spec\":{\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"names\":{\"plural\":\"foobars\",\"singular\":\"foobar\",\"shortNames\":[\"fb\"],\"kind\":\"FooBar\",\"listKind\":\"FooBarList\"},\"scope\":\"Namespaced\",\"versions\":[{\"name\":\"v1\",\"served\":true,\"storage\":true,\"schema\":{\"openAPIV3Schema\":{\"type\":\"object\",\"properties\":{\"spec\":{\"type\":\"object\",\"required\":[\"prop1\",\"prop2\",\"prop4\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"},\"prop4\":{\"x-kubernetes-int-or-string\":true}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":null,\"acceptedNames\":{\"plural\":\"\",\"kind\":\"\"},\"storedVersions\":[\"v1\"]}}\n" + }, + { + "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"28bb69f7-b200-447a-8d6e-e5b5c5a5c374\",\"resourceVersion\":\"563\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:acceptedNames\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:conditions\":{\"k:{\\\"type\\\":\\\"Established\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"NamesAccepted\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:conversion\":{\".\":{},\"f:strategy\":{}},\"f:group\":{},\"f:names\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:scope\":{},\"f:versions\":{}}}}]},\"spec\":{\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"names\":{\"plural\":\"foobars\",\"singular\":\"foobar\",\"shortNames\":[\"fb\"],\"kind\":\"FooBar\",\"listKind\":\"FooBarList\"},\"scope\":\"Namespaced\",\"versions\":[{\"name\":\"v1\",\"served\":true,\"storage\":true,\"schema\":{\"openAPIV3Schema\":{\"type\":\"object\",\"properties\":{\"spec\":{\"type\":\"object\",\"required\":[\"prop1\",\"prop2\",\"prop4\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"},\"prop4\":{\"x-kubernetes-int-or-string\":true}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"False\",\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"Installing\",\"message\":\"the initial names have been accepted\"}],\"acceptedNames\":{\"plural\":\"foobars\",\"singular\":\"foobar\",\"shortNames\":[\"fb\"],\"kind\":\"FooBar\",\"listKind\":\"FooBarList\"},\"storedVersions\":[\"v1\"]}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"name\":\"fb1\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop4\":6}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"619\",\"uid\":\"b325914d-c88c-43d8-bf5d-e21d5d66e736\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop4\":6}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"name\":\"fb2\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop3\":5,\"prop4\":\"value4\"}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop3\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb2\",\"namespace\":\"default\",\"resourceVersion\":\"620\",\"uid\":\"c011fc28-a8e4-4e6b-a4ec-c8b138a683c1\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop3\":5,\"prop4\":\"value4\"}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"items\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"619\",\"uid\":\"b325914d-c88c-43d8-bf5d-e21d5d66e736\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop4\":6}},{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop3\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb2\",\"namespace\":\"default\",\"resourceVersion\":\"620\",\"uid\":\"c011fc28-a8e4-4e6b-a4ec-c8b138a683c1\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop3\":5,\"prop4\":\"value4\"}}],\"kind\":\"FooBarList\",\"metadata\":{\"continue\":\"\",\"resourceVersion\":\"620\"}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"619\",\"uid\":\"b325914d-c88c-43d8-bf5d-e21d5d66e736\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop4\":6}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb2", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop3\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb2\",\"namespace\":\"default\",\"resourceVersion\":\"620\",\"uid\":\"c011fc28-a8e4-4e6b-a4ec-c8b138a683c1\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop3\":5,\"prop4\":\"value4\"}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars?&watch=true", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"type\":\"ADDED\",\"object\":{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb1\",\"namespace\":\"default\",\"resourceVersion\":\"619\",\"uid\":\"b325914d-c88c-43d8-bf5d-e21d5d66e736\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop4\":6}}}\n{\"type\":\"ADDED\",\"object\":{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"creationTimestamp\":\"2024-04-17T21:59:29Z\",\"generation\":1,\"managedFields\":[{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\".\":{},\"f:prop1\":{},\"f:prop2\":{},\"f:prop3\":{},\"f:prop4\":{}}},\"manager\":\"unknown\",\"operation\":\"Update\",\"time\":\"2024-04-17T21:59:29Z\"}],\"name\":\"fb2\",\"namespace\":\"default\",\"resourceVersion\":\"620\",\"uid\":\"c011fc28-a8e4-4e6b-a4ec-c8b138a683c1\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true,false,true],\"prop3\":5,\"prop4\":\"value4\"}}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb1", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb1\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"b325914d-c88c-43d8-bf5d-e21d5d66e736\"}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars/fb2", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"fb2\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"foobars\",\"uid\":\"c011fc28-a8e4-4e6b-a4ec-c8b138a683c1\"}}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"name\":\"fb3\"},\"spec\":{\"prop1\":\"value1\",\"prop4\":\"value4\"}}", + "request_content_type": "application/json", + "response_status_code": 422, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"FooBar.k8s-openapi-tests-custom-resource-definition.com \\\"fb3\\\" is invalid: spec.prop2: Required value\",\"reason\":\"Invalid\",\"details\":{\"name\":\"fb3\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"FooBar\",\"causes\":[{\"reason\":\"FieldValueRequired\",\"message\":\"Required value\",\"field\":\"spec.prop2\"}]},\"code\":422}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"name\":\"fb3\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":true,\"prop4\":\"value4\"}}", + "request_content_type": "application/json", + "response_status_code": 422, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"FooBar.k8s-openapi-tests-custom-resource-definition.com \\\"fb3\\\" is invalid: spec.prop2: Invalid value: \\\"boolean\\\": spec.prop2 in body must be of type array: \\\"boolean\\\"\",\"reason\":\"Invalid\",\"details\":{\"name\":\"fb3\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"FooBar\",\"causes\":[{\"reason\":\"FieldValueTypeInvalid\",\"message\":\"Invalid value: \\\"boolean\\\": spec.prop2 in body must be of type array: \\\"boolean\\\"\",\"field\":\"spec.prop2\"}]},\"code\":422}\n" + }, + { + "request_url": "/apis/k8s-openapi-tests-custom-resource-definition.com/v1/namespaces/default/foobars", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"k8s-openapi-tests-custom-resource-definition.com/v1\",\"kind\":\"FooBar\",\"metadata\":{\"name\":\"fb3\"},\"spec\":{\"prop1\":\"value1\",\"prop2\":[true],\"prop4\":true}}", + "request_content_type": "application/json", + "response_status_code": 422, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"FooBar.k8s-openapi-tests-custom-resource-definition.com \\\"fb3\\\" is invalid: spec.prop4: Invalid value: \\\"boolean\\\": spec.prop4 in body must be of type integer,string: \\\"boolean\\\"\",\"reason\":\"Invalid\",\"details\":{\"name\":\"fb3\",\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"kind\":\"FooBar\",\"causes\":[{\"reason\":\"FieldValueTypeInvalid\",\"message\":\"Invalid value: \\\"boolean\\\": spec.prop4 in body must be of type integer,string: \\\"boolean\\\"\",\"field\":\"spec.prop4\"}]},\"code\":422}\n" + }, + { + "request_url": "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/foobars.k8s-openapi-tests-custom-resource-definition.com", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"CustomResourceDefinition\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"metadata\":{\"name\":\"foobars.k8s-openapi-tests-custom-resource-definition.com\",\"uid\":\"28bb69f7-b200-447a-8d6e-e5b5c5a5c374\",\"resourceVersion\":\"623\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"deletionTimestamp\":\"2024-04-17T21:59:29Z\",\"finalizers\":[\"customresourcecleanup.apiextensions.k8s.io\"],\"managedFields\":[{\"manager\":\"kube-apiserver\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:acceptedNames\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:conditions\":{\"k:{\\\"type\\\":\\\"Established\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"NamesAccepted\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apiextensions.k8s.io/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:conversion\":{\".\":{},\"f:strategy\":{}},\"f:group\":{},\"f:names\":{\"f:kind\":{},\"f:listKind\":{},\"f:plural\":{},\"f:shortNames\":{},\"f:singular\":{}},\"f:scope\":{},\"f:versions\":{}}}}]},\"spec\":{\"group\":\"k8s-openapi-tests-custom-resource-definition.com\",\"names\":{\"plural\":\"foobars\",\"singular\":\"foobar\",\"shortNames\":[\"fb\"],\"kind\":\"FooBar\",\"listKind\":\"FooBarList\"},\"scope\":\"Namespaced\",\"versions\":[{\"name\":\"v1\",\"served\":true,\"storage\":true,\"schema\":{\"openAPIV3Schema\":{\"type\":\"object\",\"properties\":{\"spec\":{\"type\":\"object\",\"required\":[\"prop1\",\"prop2\",\"prop4\"],\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"array\",\"items\":{\"type\":\"boolean\"}},\"prop3\":{\"type\":\"integer\",\"format\":\"int32\"},\"prop4\":{\"x-kubernetes-int-or-string\":true}}}}}},\"subresources\":{\"status\":{}}}],\"conversion\":{\"strategy\":\"None\"}},\"status\":{\"conditions\":[{\"type\":\"NamesAccepted\",\"status\":\"True\",\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"NoConflicts\",\"message\":\"no conflicts found\"},{\"type\":\"Established\",\"status\":\"True\",\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"InitialNamesAccepted\",\"message\":\"the initial names have been accepted\"},{\"type\":\"Terminating\",\"status\":\"True\",\"lastTransitionTime\":\"2024-04-17T21:59:29Z\",\"reason\":\"InstanceDeletionPending\",\"message\":\"CustomResourceDefinition marked for deletion; CustomResource deletion will begin soon\"}],\"acceptedNames\":{\"plural\":\"foobars\",\"singular\":\"foobar\",\"shortNames\":[\"fb\"],\"kind\":\"FooBar\",\"listKind\":\"FooBarList\"},\"storedVersions\":[\"v1\"]}}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/deployment-list.json b/k8s-openapi-tests/test-replays/v1-30/deployment-list.json new file mode 100644 index 000000000..0780a11ab --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/deployment-list.json @@ -0,0 +1,10 @@ +[ + { + "request_url": "/apis/apps/v1/namespaces/kube-system/deployments", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"DeploymentList\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"resourceVersion\":\"557\"},\"items\":[{\"metadata\":{\"name\":\"coredns\",\"namespace\":\"kube-system\",\"uid\":\"e351fa6a-25f7-439f-98e1-f423b24237c7\",\"resourceVersion\":\"477\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"k8s-app\":\"kube-dns\"},\"annotations\":{\"deployment.kubernetes.io/revision\":\"1\"},\"managedFields\":[{\"manager\":\"kubeadm\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-app\":{}}},\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:replicas\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-app\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}}}},{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:deployment.kubernetes.io/revision\":{}}},\"f:status\":{\"f:availableReplicas\":{},\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"Available\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:lastUpdateTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Progressing\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:lastUpdateTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:observedGeneration\":{},\"f:readyReplicas\":{},\"f:replicas\":{},\"f:updatedReplicas\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"replicas\":2,\"selector\":{\"matchLabels\":{\"k8s-app\":\"kube-dns\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"k8s-app\":\"kube-dns\"}},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"}],\"priorityClassName\":\"system-cluster-critical\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":1,\"maxSurge\":\"25%\"}},\"revisionHistoryLimit\":10,\"progressDeadlineSeconds\":600},\"status\":{\"observedGeneration\":1,\"replicas\":2,\"updatedReplicas\":2,\"readyReplicas\":2,\"availableReplicas\":2,\"conditions\":[{\"type\":\"Available\",\"status\":\"True\",\"lastUpdateTime\":\"2024-04-17T21:58:26Z\",\"lastTransitionTime\":\"2024-04-17T21:58:26Z\",\"reason\":\"MinimumReplicasAvailable\",\"message\":\"Deployment has minimum availability.\"},{\"type\":\"Progressing\",\"status\":\"True\",\"lastUpdateTime\":\"2024-04-17T21:58:26Z\",\"lastTransitionTime\":\"2024-04-17T21:58:22Z\",\"reason\":\"NewReplicaSetAvailable\",\"message\":\"ReplicaSet \\\"coredns-7db6d8ff4d\\\" has successfully progressed.\"}]}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/job-create.json b/k8s-openapi-tests/test-replays/v1-30/job-create.json new file mode 100644 index 000000000..5ec6bd10e --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/job-create.json @@ -0,0 +1,98 @@ +[ + { + "request_url": "/apis/batch/v1/namespaces/default/jobs", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\"},\"spec\":{\"backoffLimit\":0,\"template\":{\"spec\":{\"containers\":[{\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"image\":\"alpine\",\"name\":\"k8s-openapi-tests-create-job\"}],\"restartPolicy\":\"Never\"}}}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"561\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"561\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"579\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:active\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"},{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"startTime\":\"2024-04-17T21:59:27Z\",\"active\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"639\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}},{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:33Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2024-04-17T21:59:33Z\",\"lastTransitionTime\":\"2024-04-17T21:59:33Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2024-04-17T21:59:27Z\",\"failed\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/api/v1/namespaces/default/pods", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"640\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-9gsfq\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"449577ee-78c1-447e-8628-05c7740e6658\",\"resourceVersion\":\"638\",\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:batch.kubernetes.io/controller-uid\":{},\"f:batch.kubernetes.io/job-name\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:33Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.5\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-fqxsg\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-fqxsg\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"serviceAccountName\":\"default\",\"serviceAccount\":\"default\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Failed\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:32Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.5\",\"podIPs\":[{\"ip\":\"10.244.0.5\"}],\"startTime\":\"2024-04-17T21:59:27Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2024-04-17T21:59:30Z\",\"finishedAt\":\"2024-04-17T21:59:30Z\",\"containerID\":\"containerd://82ba8a1ad90bad561c2b97d6b6ad4b08c4f94ade8cc6b5a2c3b649ea169befad\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\",\"containerID\":\"containerd://82ba8a1ad90bad561c2b97d6b6ad4b08c4f94ade8cc6b5a2c3b649ea169befad\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" + }, + { + "request_url": "/apis/batch/v1/namespaces/default/jobs/k8s-openapi-tests-create-job", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Job\",\"apiVersion\":\"batch/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-create-job\",\"namespace\":\"default\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"resourceVersion\":\"641\",\"generation\":2,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"deletionTimestamp\":\"2024-04-17T21:59:34Z\",\"deletionGracePeriodSeconds\":0,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"finalizers\":[\"orphan\"],\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:backoffLimit\":{},\"f:completionMode\":{},\"f:completions\":{},\"f:manualSelector\":{},\"f:parallelism\":{},\"f:podReplacementPolicy\":{},\"f:suspend\":{},\"f:template\":{\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}},{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"batch/v1\",\"time\":\"2024-04-17T21:59:33Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{},\"f:failed\":{},\"f:ready\":{},\"f:startTime\":{},\"f:terminating\":{},\"f:uncountedTerminatedPods\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"parallelism\":1,\"completions\":1,\"backoffLimit\":0,\"selector\":{\"matchLabels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\"}},\"manualSelector\":false,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"completionMode\":\"NonIndexed\",\"suspend\":false,\"podReplacementPolicy\":\"TerminatingOrFailed\"},\"status\":{\"conditions\":[{\"type\":\"Failed\",\"status\":\"True\",\"lastProbeTime\":\"2024-04-17T21:59:33Z\",\"lastTransitionTime\":\"2024-04-17T21:59:33Z\",\"reason\":\"BackoffLimitExceeded\",\"message\":\"Job has reached the specified backoff limit\"}],\"startTime\":\"2024-04-17T21:59:27Z\",\"failed\":1,\"terminating\":0,\"uncountedTerminatedPods\":{},\"ready\":0}}\n" + }, + { + "request_url": "/api/v1/namespaces/default/pods?&labelSelector=job-name%3Dk8s-openapi-tests-create-job", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"641\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-create-job-9gsfq\",\"generateName\":\"k8s-openapi-tests-create-job-\",\"namespace\":\"default\",\"uid\":\"449577ee-78c1-447e-8628-05c7740e6658\",\"resourceVersion\":\"638\",\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"batch.kubernetes.io/controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"batch.kubernetes.io/job-name\":\"k8s-openapi-tests-create-job\",\"controller-uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"job-name\":\"k8s-openapi-tests-create-job\"},\"ownerReferences\":[{\"apiVersion\":\"batch/v1\",\"kind\":\"Job\",\"name\":\"k8s-openapi-tests-create-job\",\"uid\":\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:batch.kubernetes.io/controller-uid\":{},\"f:batch.kubernetes.io/job-name\":{},\"f:controller-uid\":{},\"f:job-name\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"8e59eed2-4ed6-48c8-b122-b29b809ea8dc\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-create-job\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"TEST_ARG\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:33Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.5\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-fqxsg\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-create-job\",\"image\":\"alpine\",\"command\":[\"sh\",\"-c\",\"exit $TEST_ARG\"],\"env\":[{\"name\":\"TEST_ARG\",\"value\":\"5\"}],\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-fqxsg\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"Always\"}],\"restartPolicy\":\"Never\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"serviceAccountName\":\"default\",\"serviceAccount\":\"default\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Failed\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:32Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"},{\"type\":\"Ready\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"PodFailed\"},{\"type\":\"ContainersReady\",\"status\":\"False\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\",\"reason\":\"PodFailed\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.5\",\"podIPs\":[{\"ip\":\"10.244.0.5\"}],\"startTime\":\"2024-04-17T21:59:27Z\",\"containerStatuses\":[{\"name\":\"k8s-openapi-tests-create-job\",\"state\":{\"terminated\":{\"exitCode\":5,\"reason\":\"Error\",\"startedAt\":\"2024-04-17T21:59:30Z\",\"finishedAt\":\"2024-04-17T21:59:30Z\",\"containerID\":\"containerd://82ba8a1ad90bad561c2b97d6b6ad4b08c4f94ade8cc6b5a2c3b649ea169befad\"}},\"lastState\":{},\"ready\":false,\"restartCount\":0,\"image\":\"docker.io/library/alpine:latest\",\"imageID\":\"docker.io/library/alpine@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b\",\"containerID\":\"containerd://82ba8a1ad90bad561c2b97d6b6ad4b08c4f94ade8cc6b5a2c3b649ea169befad\",\"started\":false}],\"qosClass\":\"BestEffort\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/patch-deployment.json b/k8s-openapi-tests/test-replays/v1-30/patch-deployment.json new file mode 100644 index 000000000..7d5e310e8 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/patch-deployment.json @@ -0,0 +1,50 @@ +[ + { + "request_url": "/apis/apps/v1/namespaces/default/deployments", + "request_method": "POST", + "request_body": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\"},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"template\":{\"metadata\":{\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"spec\":{\"containers\":[{\"image\":\"alpine:3.6\",\"name\":\"k8s-openapi-tests-patch-deployment\"}]}}}}", + "request_content_type": "application/json", + "response_status_code": 201, + "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"95734772-161f-4f58-881f-7902853b7353\",\"resourceVersion\":\"560\",\"generation\":1,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:replicas\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.6\",\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":\"25%\",\"maxSurge\":\"25%\"}},\"revisionHistoryLimit\":10,\"progressDeadlineSeconds\":600},\"status\":{}}\n" + }, + { + "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", + "request_method": "PATCH", + "request_body": "[{\"op\":\"test\",\"path\":\"/spec/template/spec/containers/0/image\",\"value\":\"alpine:3.6\"},{\"op\":\"replace\",\"path\":\"/spec/template/spec/containers/0/image\",\"value\":\"alpine:3.7\"}]", + "request_content_type": "application/json-patch+json", + "response_status_code": 200, + "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"95734772-161f-4f58-881f-7902853b7353\",\"resourceVersion\":\"565\",\"generation\":2,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:replicas\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.7\",\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":\"25%\",\"maxSurge\":\"25%\"}},\"revisionHistoryLimit\":10,\"progressDeadlineSeconds\":600},\"status\":{}}\n" + }, + { + "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", + "request_method": "PATCH", + "request_body": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{},\"spec\":{\"selector\":{},\"template\":{\"spec\":{\"containers\":[{\"image\":\"alpine:3.8\",\"name\":\"k8s-openapi-tests-patch-deployment\"}]}}}}", + "request_content_type": "application/merge-patch+json", + "response_status_code": 200, + "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"95734772-161f-4f58-881f-7902853b7353\",\"resourceVersion\":\"567\",\"generation\":3,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:replicas\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.8\",\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":\"25%\",\"maxSurge\":\"25%\"}},\"revisionHistoryLimit\":10,\"progressDeadlineSeconds\":600},\"status\":{}}\n" + }, + { + "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", + "request_method": "PATCH", + "request_body": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{},\"spec\":{\"selector\":{},\"template\":{\"spec\":{\"containers\":[{\"image\":\"alpine:3.9\",\"name\":\"k8s-openapi-tests-patch-deployment\"}]}}}}", + "request_content_type": "application/strategic-merge-patch+json", + "response_status_code": 200, + "response_body": "{\"kind\":\"Deployment\",\"apiVersion\":\"apps/v1\",\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"namespace\":\"default\",\"uid\":\"95734772-161f-4f58-881f-7902853b7353\",\"resourceVersion\":\"572\",\"generation\":4,\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"managedFields\":[{\"manager\":\"unknown\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:replicas\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}}}]},\"spec\":{\"replicas\":1,\"selector\":{\"matchLabels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\"}},\"spec\":{\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.9\",\"resources\":{},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":\"25%\",\"maxSurge\":\"25%\"}},\"revisionHistoryLimit\":10,\"progressDeadlineSeconds\":600},\"status\":{}}\n" + }, + { + "request_url": "/apis/apps/v1/namespaces/default/deployments/k8s-openapi-tests-patch-deployment", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Success\",\"details\":{\"name\":\"k8s-openapi-tests-patch-deployment\",\"group\":\"apps\",\"kind\":\"deployments\",\"uid\":\"95734772-161f-4f58-881f-7902853b7353\"}}\n" + }, + { + "request_url": "/api/v1/namespaces/default/pods?&labelSelector=k8s-openapi-tests-patch-deployment-key%3Dk8s-openapi-tests-patch-deployment-value", + "request_method": "DELETE", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"587\"},\"items\":[{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-75bfb5d877-pvftq\",\"generateName\":\"k8s-openapi-tests-patch-deployment-75bfb5d877-\",\"namespace\":\"default\",\"uid\":\"1d077f22-ce9e-4716-bc10-a66375574bfc\",\"resourceVersion\":\"576\",\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"75bfb5d877\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-75bfb5d877\",\"uid\":\"b797520e-2e99-417a-bc13-8cff55ce574a\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"b797520e-2e99-417a-bc13-8cff55ce574a\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-cqnmg\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.6\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-cqnmg\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"serviceAccountName\":\"default\",\"serviceAccount\":\"default\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Pending\",\"conditions\":[{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"k8s-openapi-tests-patch-deployment-799464b695-m9jn2\",\"generateName\":\"k8s-openapi-tests-patch-deployment-799464b695-\",\"namespace\":\"default\",\"uid\":\"aeb850cc-2e30-48c9-8cac-8301f387c098\",\"resourceVersion\":\"582\",\"creationTimestamp\":\"2024-04-17T21:59:27Z\",\"labels\":{\"k8s-openapi-tests-patch-deployment-key\":\"k8s-openapi-tests-patch-deployment-value\",\"pod-template-hash\":\"799464b695\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"k8s-openapi-tests-patch-deployment-799464b695\",\"uid\":\"03203996-859c-41d7-ba02-961cd8e133b8\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:59:27Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-openapi-tests-patch-deployment-key\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"03203996-859c-41d7-ba02-961cd8e133b8\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"k8s-openapi-tests-patch-deployment\\\"}\":{\".\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:terminationGracePeriodSeconds\":{}}}}]},\"spec\":{\"volumes\":[{\"name\":\"kube-api-access-xgqqr\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"k8s-openapi-tests-patch-deployment\",\"image\":\"alpine:3.8\",\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-api-access-xgqqr\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"serviceAccountName\":\"default\",\"serviceAccount\":\"default\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Pending\",\"conditions\":[{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:59:27Z\"}],\"qosClass\":\"BestEffort\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/pod-list.json b/k8s-openapi-tests/test-replays/v1-30/pod-list.json new file mode 100644 index 000000000..9f832d04c --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/pod-list.json @@ -0,0 +1,10 @@ +[ + { + "request_url": "/api/v1/namespaces/kube-system/pods", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"kind\":\"PodList\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"558\"},\"items\":[{\"metadata\":{\"name\":\"coredns-7db6d8ff4d-lw4tm\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"0c3a7eb0-656c-442b-890f-f5b6a9e07b06\",\"resourceVersion\":\"468\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-5tq5w\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-5tq5w\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://955a1d026fcc0a8e695f6085554c53e7ca861bddca388c1d02c6c7ba4ef73e08\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"coredns-7db6d8ff4d-xr852\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"5c2d0fa2-abb8-4037-99c4-a5c4a6e2ae6e\",\"resourceVersion\":\"472\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.3\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-rjqst\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-rjqst\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.3\",\"podIPs\":[{\"ip\":\"10.244.0.3\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://ad9b619705e998dca9049f97e9ffde66f33470e5751c24b6b26f15e4c22eba2b\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"etcd-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"e193fc5b-b829-4177-9ca6-fda0bbebb5f2\",\"resourceVersion\":\"336\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.19.0.2:2379\",\"kubernetes.io/config.hash\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.mirror\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402397421Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/etcd.advertise-client-urls\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"etcd-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki/etcd\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etcd-data\",\"hostPath\":{\"path\":\"/var/lib/etcd\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"etcd\",\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.19.0.2:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--experimental-watch-progress-notify-interval=5s\",\"--initial-advertise-peer-urls=https://172.19.0.2:2380\",\"--initial-cluster=v1.30-control-plane=https://172.19.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.19.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.19.0.2:2380\",\"--name=v1.30-control-plane\",\"--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt\",\"--peer-client-cert-auth=true\",\"--peer-key-file=/etc/kubernetes/pki/etcd/peer.key\",\"--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\",\"--snapshot-count=10000\",\"--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\"],\"resources\":{\"requests\":{\"cpu\":\"100m\",\"memory\":\"100Mi\"}},\"volumeMounts\":[{\"name\":\"etcd-data\",\"mountPath\":\"/var/lib/etcd\"},{\"name\":\"etcd-certs\",\"mountPath\":\"/etc/kubernetes/pki/etcd\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health?exclude=NOSPACE\\u0026serializable=true\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health?serializable=false\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:03Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"imageID\":\"sha256:3861cfcd7c04ccac1f062788eca39487248527ef0c0cfd477a83d7691a75a899\",\"containerID\":\"containerd://a7daffd742cc989ca103ad8de04416c9916573d675d0e81527a9340972a623f9\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kindnet-9974f\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"15cb677f-75dc-4eba-9300-9b1d884bbfec\",\"resourceVersion\":\"448\",\"creationTimestamp\":\"2024-04-17T21:58:22Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"8bffc7d67\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"5779eeb6-1881-43c1-882f-00656189015f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:22Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:app\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"5779eeb6-1881-43c1-882f-00656189015f\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"cni-cfg\",\"hostPath\":{\"path\":\"/etc/cni/net.d\",\"type\":\"\"}},{\"name\":\"xtables-lock\",\"hostPath\":{\"path\":\"/run/xtables.lock\",\"type\":\"FileOrCreate\"}},{\"name\":\"lib-modules\",\"hostPath\":{\"path\":\"/lib/modules\",\"type\":\"\"}},{\"name\":\"kube-api-access-zvv2z\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"kindnet-cni\",\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"env\":[{\"name\":\"HOST_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.hostIP\"}}},{\"name\":\"POD_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.podIP\"}}},{\"name\":\"POD_SUBNET\",\"value\":\"10.244.0.0/16\"},{\"name\":\"CONTROL_PLANE_ENDPOINT\",\"value\":\"v1.30-control-plane:6443\"}],\"resources\":{\"limits\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"}},\"volumeMounts\":[{\"name\":\"cni-cfg\",\"mountPath\":\"/etc/cni/net.d\"},{\"name\":\"xtables-lock\",\"mountPath\":\"/run/xtables.lock\"},{\"name\":\"lib-modules\",\"readOnly\":true,\"mountPath\":\"/lib/modules\"},{\"name\":\"kube-api-access-zvv2z\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.30-control-plane\"]}]}]}}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/disk-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/memory-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/pid-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/unschedulable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/network-unavailable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:22Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"imageID\":\"sha256:4950bb10b3f87e8d4a8f772a0d8934625cac4ccfa3675fea34cad0dab83fd5a5\",\"containerID\":\"containerd://6b59dfb49698b69018fe8c9fb49f1a60d269b9a696c7f9df25aaa1ab0515d945\",\"started\":true}],\"qosClass\":\"Guaranteed\"}},{\"metadata\":{\"name\":\"kube-apiserver-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"fda69a5d-714a-4e5e-ad16-8b7a5f6e29c1\",\"resourceVersion\":\"351\",\"creationTimestamp\":\"2024-04-17T21:58:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.19.0.2:6443\",\"kubernetes.io/config.hash\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.mirror\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:01.064583866Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"ca-certs\",\"hostPath\":{\"path\":\"/etc/ssl/certs\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etc-ca-certificates\",\"hostPath\":{\"path\":\"/etc/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"k8s-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-local-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/local/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"kube-apiserver\",\"image\":\"registry.k8s.io/kube-apiserver:v1.30.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.19.0.2\",\"--allow-privileged=true\",\"--authorization-mode=Node,RBAC\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--enable-admission-plugins=NodeRestriction\",\"--enable-bootstrap-token-auth=true\",\"--etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt\",\"--etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt\",\"--etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key\",\"--etcd-servers=https://127.0.0.1:2379\",\"--feature-gates=WatchList=true\",\"--kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt\",\"--kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key\",\"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname\",\"--proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt\",\"--proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key\",\"--requestheader-allowed-names=front-proxy-client\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--requestheader-extra-headers-prefix=X-Remote-Extra-\",\"--requestheader-group-headers=X-Remote-Group\",\"--requestheader-username-headers=X-Remote-User\",\"--runtime-config=\",\"--secure-port=6443\",\"--service-account-issuer=https://kubernetes.default.svc.cluster.local\",\"--service-account-key-file=/etc/kubernetes/pki/sa.pub\",\"--service-account-signing-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--tls-cert-file=/etc/kubernetes/pki/apiserver.crt\",\"--tls-private-key-file=/etc/kubernetes/pki/apiserver.key\"],\"resources\":{\"requests\":{\"cpu\":\"250m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:36ff3418ec18184f1aefe275b20f4b1e1681b78bb84c36ef619135e7abf4efa1\",\"containerID\":\"containerd://38e1122b81212fd07f0e3c4e71a8c7ae6da0cf8b3657aa3d1777862587d3214d\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-controller-manager-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"c7c78430-1b31-4448-a652-07941e2d54dd\",\"resourceVersion\":\"345\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"a90f961b5236312cebfe37ce2a436436\",\"kubernetes.io/config.mirror\":\"a90f961b5236312cebfe37ce2a436436\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402399245Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-controller-manager\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/controller-manager.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"flexvolume-dir\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"ca-certs\",\"hostPath\":{\"path\":\"/etc/ssl/certs\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etc-ca-certificates\",\"hostPath\":{\"path\":\"/etc/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"flexvolume-dir\",\"hostPath\":{\"path\":\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"k8s-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"kubeconfig\",\"hostPath\":{\"path\":\"/etc/kubernetes/controller-manager.conf\",\"type\":\"FileOrCreate\"}},{\"name\":\"usr-local-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/local/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"kube-controller-manager\",\"image\":\"registry.k8s.io/kube-controller-manager:v1.30.0\",\"command\":[\"kube-controller-manager\",\"--allocate-node-cidrs=true\",\"--authentication-kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--authorization-kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--bind-address=127.0.0.1\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--cluster-cidr=10.244.0.0/16\",\"--cluster-name=v1.30\",\"--cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt\",\"--cluster-signing-key-file=/etc/kubernetes/pki/ca.key\",\"--controllers=*,bootstrapsigner,tokencleaner\",\"--enable-hostpath-provisioner=true\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--leader-elect=true\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--root-ca-file=/etc/kubernetes/pki/ca.crt\",\"--service-account-private-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--use-service-account-credentials=true\"],\"resources\":{\"requests\":{\"cpu\":\"200m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"flexvolume-dir\",\"mountPath\":\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/controller-manager.conf\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:03Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:80d77e09badd17d5dc43178b6f5008d2c7d70a9909a29ef810c1e7d6e8ea6a3f\",\"containerID\":\"containerd://a6ab294d28cf10b0cdd0efa4d5b841a45bb58c26be1aa81874bebcbf9d25fb80\",\"started\":true}],\"qosClass\":\"Burstable\"}},{\"metadata\":{\"name\":\"kube-proxy-lgcgf\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"833ebf1d-0efd-4d22-a0b9-b248969f1203\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2024-04-17T21:58:22Z\",\"labels\":{\"controller-revision-hash\":\"79cf874c65\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"96545a93-5c47-4750-b00e-6af439a83f95\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:22Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"96545a93-5c47-4750-b00e-6af439a83f95\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-proxy\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"NODE_NAME\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:securityContext\":{\".\":{},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/kube-proxy\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kube-proxy\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:name\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-proxy\",\"configMap\":{\"name\":\"kube-proxy\",\"defaultMode\":420}},{\"name\":\"xtables-lock\",\"hostPath\":{\"path\":\"/run/xtables.lock\",\"type\":\"FileOrCreate\"}},{\"name\":\"lib-modules\",\"hostPath\":{\"path\":\"/lib/modules\",\"type\":\"\"}},{\"name\":\"kube-api-access-mwl8p\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"kube-proxy\",\"image\":\"registry.k8s.io/kube-proxy:v1.30.0\",\"command\":[\"/usr/local/bin/kube-proxy\",\"--config=/var/lib/kube-proxy/config.conf\",\"--hostname-override=$(NODE_NAME)\"],\"env\":[{\"name\":\"NODE_NAME\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"spec.nodeName\"}}}],\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-proxy\",\"mountPath\":\"/var/lib/kube-proxy\"},{\"name\":\"xtables-lock\",\"mountPath\":\"/run/xtables.lock\"},{\"name\":\"lib-modules\",\"readOnly\":true,\"mountPath\":\"/lib/modules\"},{\"name\":\"kube-api-access-mwl8p\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"privileged\":true}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kube-proxy\",\"serviceAccount\":\"kube-proxy\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.30-control-plane\"]}]}]}}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/disk-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/memory-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/pid-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/unschedulable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/network-unavailable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:22Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:4cdfd6baac79d10c8154c18ef8451cbfc1b02071fca818730f70a0a0770cb468\",\"containerID\":\"containerd://e7195007bb58050e868013d68ee1a64a0cdbdbc39c5bfed5111479647f04725d\",\"started\":true}],\"qosClass\":\"BestEffort\"}},{\"metadata\":{\"name\":\"kube-scheduler-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"78a13980-3d18-444a-810e-7bdd6855cc5b\",\"resourceVersion\":\"347\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"fe1777cb28f90924cb0cad5e2fbe52bd\",\"kubernetes.io/config.mirror\":\"fe1777cb28f90924cb0cad5e2fbe52bd\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402394265Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-scheduler\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/scheduler.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kubeconfig\",\"hostPath\":{\"path\":\"/etc/kubernetes/scheduler.conf\",\"type\":\"FileOrCreate\"}}],\"containers\":[{\"name\":\"kube-scheduler\",\"image\":\"registry.k8s.io/kube-scheduler:v1.30.0\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/scheduler.conf\",\"--leader-elect=true\"],\"resources\":{\"requests\":{\"cpu\":\"100m\"}},\"volumeMounts\":[{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/scheduler.conf\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:34efc4f308e6dae9c0b59d77442866d9731340a5af4c42f196840cb0206cf2f5\",\"containerID\":\"containerd://64f67c5d5390f3fd6c2f266e7ba966bb3167a353bcfa160bab0e79478dc67277\",\"started\":true}],\"qosClass\":\"Burstable\"}}]}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods.json b/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods.json new file mode 100644 index 000000000..f09a99800 --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods.json @@ -0,0 +1,10 @@ +[ + { + "request_url": "/api/v1/namespaces/kube-system/pods?&watch=true", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-7db6d8ff4d-lw4tm\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"0c3a7eb0-656c-442b-890f-f5b6a9e07b06\",\"resourceVersion\":\"468\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-5tq5w\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-5tq5w\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://955a1d026fcc0a8e695f6085554c53e7ca861bddca388c1d02c6c7ba4ef73e08\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-7db6d8ff4d-xr852\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"5c2d0fa2-abb8-4037-99c4-a5c4a6e2ae6e\",\"resourceVersion\":\"472\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.3\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-rjqst\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-rjqst\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.3\",\"podIPs\":[{\"ip\":\"10.244.0.3\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://ad9b619705e998dca9049f97e9ffde66f33470e5751c24b6b26f15e4c22eba2b\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"etcd-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"e193fc5b-b829-4177-9ca6-fda0bbebb5f2\",\"resourceVersion\":\"336\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.19.0.2:2379\",\"kubernetes.io/config.hash\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.mirror\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402397421Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/etcd.advertise-client-urls\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"etcd-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki/etcd\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etcd-data\",\"hostPath\":{\"path\":\"/var/lib/etcd\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"etcd\",\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.19.0.2:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--experimental-watch-progress-notify-interval=5s\",\"--initial-advertise-peer-urls=https://172.19.0.2:2380\",\"--initial-cluster=v1.30-control-plane=https://172.19.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.19.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.19.0.2:2380\",\"--name=v1.30-control-plane\",\"--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt\",\"--peer-client-cert-auth=true\",\"--peer-key-file=/etc/kubernetes/pki/etcd/peer.key\",\"--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\",\"--snapshot-count=10000\",\"--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\"],\"resources\":{\"requests\":{\"cpu\":\"100m\",\"memory\":\"100Mi\"}},\"volumeMounts\":[{\"name\":\"etcd-data\",\"mountPath\":\"/var/lib/etcd\"},{\"name\":\"etcd-certs\",\"mountPath\":\"/etc/kubernetes/pki/etcd\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health?exclude=NOSPACE\\u0026serializable=true\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health?serializable=false\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:03Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"imageID\":\"sha256:3861cfcd7c04ccac1f062788eca39487248527ef0c0cfd477a83d7691a75a899\",\"containerID\":\"containerd://a7daffd742cc989ca103ad8de04416c9916573d675d0e81527a9340972a623f9\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kindnet-9974f\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"15cb677f-75dc-4eba-9300-9b1d884bbfec\",\"resourceVersion\":\"448\",\"creationTimestamp\":\"2024-04-17T21:58:22Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"8bffc7d67\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"5779eeb6-1881-43c1-882f-00656189015f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:22Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:app\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"5779eeb6-1881-43c1-882f-00656189015f\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"cni-cfg\",\"hostPath\":{\"path\":\"/etc/cni/net.d\",\"type\":\"\"}},{\"name\":\"xtables-lock\",\"hostPath\":{\"path\":\"/run/xtables.lock\",\"type\":\"FileOrCreate\"}},{\"name\":\"lib-modules\",\"hostPath\":{\"path\":\"/lib/modules\",\"type\":\"\"}},{\"name\":\"kube-api-access-zvv2z\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"kindnet-cni\",\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"env\":[{\"name\":\"HOST_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.hostIP\"}}},{\"name\":\"POD_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.podIP\"}}},{\"name\":\"POD_SUBNET\",\"value\":\"10.244.0.0/16\"},{\"name\":\"CONTROL_PLANE_ENDPOINT\",\"value\":\"v1.30-control-plane:6443\"}],\"resources\":{\"limits\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"}},\"volumeMounts\":[{\"name\":\"cni-cfg\",\"mountPath\":\"/etc/cni/net.d\"},{\"name\":\"xtables-lock\",\"mountPath\":\"/run/xtables.lock\"},{\"name\":\"lib-modules\",\"readOnly\":true,\"mountPath\":\"/lib/modules\"},{\"name\":\"kube-api-access-zvv2z\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.30-control-plane\"]}]}]}}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/disk-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/memory-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/pid-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/unschedulable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/network-unavailable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:22Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"imageID\":\"sha256:4950bb10b3f87e8d4a8f772a0d8934625cac4ccfa3675fea34cad0dab83fd5a5\",\"containerID\":\"containerd://6b59dfb49698b69018fe8c9fb49f1a60d269b9a696c7f9df25aaa1ab0515d945\",\"started\":true}],\"qosClass\":\"Guaranteed\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-apiserver-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"fda69a5d-714a-4e5e-ad16-8b7a5f6e29c1\",\"resourceVersion\":\"351\",\"creationTimestamp\":\"2024-04-17T21:58:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.19.0.2:6443\",\"kubernetes.io/config.hash\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.mirror\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:01.064583866Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"ca-certs\",\"hostPath\":{\"path\":\"/etc/ssl/certs\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etc-ca-certificates\",\"hostPath\":{\"path\":\"/etc/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"k8s-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-local-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/local/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"kube-apiserver\",\"image\":\"registry.k8s.io/kube-apiserver:v1.30.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.19.0.2\",\"--allow-privileged=true\",\"--authorization-mode=Node,RBAC\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--enable-admission-plugins=NodeRestriction\",\"--enable-bootstrap-token-auth=true\",\"--etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt\",\"--etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt\",\"--etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key\",\"--etcd-servers=https://127.0.0.1:2379\",\"--feature-gates=WatchList=true\",\"--kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt\",\"--kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key\",\"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname\",\"--proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt\",\"--proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key\",\"--requestheader-allowed-names=front-proxy-client\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--requestheader-extra-headers-prefix=X-Remote-Extra-\",\"--requestheader-group-headers=X-Remote-Group\",\"--requestheader-username-headers=X-Remote-User\",\"--runtime-config=\",\"--secure-port=6443\",\"--service-account-issuer=https://kubernetes.default.svc.cluster.local\",\"--service-account-key-file=/etc/kubernetes/pki/sa.pub\",\"--service-account-signing-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--tls-cert-file=/etc/kubernetes/pki/apiserver.crt\",\"--tls-private-key-file=/etc/kubernetes/pki/apiserver.key\"],\"resources\":{\"requests\":{\"cpu\":\"250m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:36ff3418ec18184f1aefe275b20f4b1e1681b78bb84c36ef619135e7abf4efa1\",\"containerID\":\"containerd://38e1122b81212fd07f0e3c4e71a8c7ae6da0cf8b3657aa3d1777862587d3214d\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n" + } +] diff --git a/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods_without_initial_events.json b/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods_without_initial_events.json new file mode 100644 index 000000000..db63b6c3e --- /dev/null +++ b/k8s-openapi-tests/test-replays/v1-30/watch_event-watch_pods_without_initial_events.json @@ -0,0 +1,10 @@ +[ + { + "request_url": "/api/v1/namespaces/kube-system/pods?&allowWatchBookmarks=true&resourceVersion=0&resourceVersionMatch=NotOlderThan&sendInitialEvents=true&watch=true", + "request_method": "GET", + "request_body": "", + "request_content_type": null, + "response_status_code": 200, + "response_body": "{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-7db6d8ff4d-lw4tm\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"0c3a7eb0-656c-442b-890f-f5b6a9e07b06\",\"resourceVersion\":\"468\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-5tq5w\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-5tq5w\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.2\",\"podIPs\":[{\"ip\":\"10.244.0.2\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://955a1d026fcc0a8e695f6085554c53e7ca861bddca388c1d02c6c7ba4ef73e08\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"coredns-7db6d8ff4d-xr852\",\"generateName\":\"coredns-7db6d8ff4d-\",\"namespace\":\"kube-system\",\"uid\":\"5c2d0fa2-abb8-4037-99c4-a5c4a6e2ae6e\",\"resourceVersion\":\"472\",\"creationTimestamp\":\"2024-04-17T21:58:23Z\",\"labels\":{\"k8s-app\":\"kube-dns\",\"pod-template-hash\":\"7db6d8ff4d\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"ReplicaSet\",\"name\":\"coredns-7db6d8ff4d\",\"uid\":\"6a65f174-109d-471d-88e3-a069f680b70b\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:k8s-app\":{},\"f:pod-template-hash\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"6a65f174-109d-471d-88e3-a069f680b70b\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:podAntiAffinity\":{\".\":{},\"f:preferredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"coredns\\\"}\":{\".\":{},\"f:args\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":53,\\\"protocol\\\":\\\"UDP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}},\"k:{\\\"containerPort\\\":9153,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:allowPrivilegeEscalation\":{},\"f:capabilities\":{\".\":{},\"f:add\":{},\"f:drop\":{}},\"f:readOnlyRootFilesystem\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/coredns\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config-volume\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:items\":{},\"f:name\":{}},\"f:name\":{}}}}}},{\"manager\":\"kube-scheduler\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:23Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}}}},\"subresource\":\"status\"},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:26Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"10.244.0.3\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"config-volume\",\"configMap\":{\"name\":\"coredns\",\"items\":[{\"key\":\"Corefile\",\"path\":\"Corefile\"}],\"defaultMode\":420}},{\"name\":\"kube-api-access-rjqst\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"coredns\",\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"args\":[\"-conf\",\"/etc/coredns/Corefile\"],\"ports\":[{\"name\":\"dns\",\"containerPort\":53,\"protocol\":\"UDP\"},{\"name\":\"dns-tcp\",\"containerPort\":53,\"protocol\":\"TCP\"},{\"name\":\"metrics\",\"containerPort\":9153,\"protocol\":\"TCP\"}],\"resources\":{\"limits\":{\"memory\":\"170Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"70Mi\"}},\"volumeMounts\":[{\"name\":\"config-volume\",\"readOnly\":true,\"mountPath\":\"/etc/coredns\"},{\"name\":\"kube-api-access-rjqst\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health\",\"port\":8080,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":60,\"timeoutSeconds\":5,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":5},\"readinessProbe\":{\"httpGet\":{\"path\":\"/ready\",\"port\":8181,\"scheme\":\"HTTP\"},\"timeoutSeconds\":1,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":3},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_BIND_SERVICE\"],\"drop\":[\"ALL\"]},\"readOnlyRootFilesystem\":true,\"allowPrivilegeEscalation\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"Default\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"coredns\",\"serviceAccount\":\"coredns\",\"nodeName\":\"v1.30-control-plane\",\"securityContext\":{},\"affinity\":{\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":100,\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"}}]}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"key\":\"CriticalAddonsOnly\",\"operator\":\"Exists\"},{\"key\":\"node-role.kubernetes.io/control-plane\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\",\"tolerationSeconds\":300}],\"priorityClassName\":\"system-cluster-critical\",\"priority\":2000000000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:26Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"10.244.0.3\",\"podIPs\":[{\"ip\":\"10.244.0.3\"}],\"startTime\":\"2024-04-17T21:58:24Z\",\"containerStatuses\":[{\"name\":\"coredns\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:25Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/coredns/coredns:v1.11.1\",\"imageID\":\"sha256:cbb01a7bd410dc08ba382018ab909a674fb0e48687f0c00797ed5bc34fcc6bb4\",\"containerID\":\"containerd://ad9b619705e998dca9049f97e9ffde66f33470e5751c24b6b26f15e4c22eba2b\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"etcd-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"e193fc5b-b829-4177-9ca6-fda0bbebb5f2\",\"resourceVersion\":\"336\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"etcd\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/etcd.advertise-client-urls\":\"https://172.19.0.2:2379\",\"kubernetes.io/config.hash\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.mirror\":\"b46f94fe31289b0ba25393a312f349fc\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402397421Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/etcd.advertise-client-urls\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"etcd\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/etcd\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"etcd-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etcd-data\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:14Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"etcd-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki/etcd\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etcd-data\",\"hostPath\":{\"path\":\"/var/lib/etcd\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"etcd\",\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"command\":[\"etcd\",\"--advertise-client-urls=https://172.19.0.2:2379\",\"--cert-file=/etc/kubernetes/pki/etcd/server.crt\",\"--client-cert-auth=true\",\"--data-dir=/var/lib/etcd\",\"--experimental-initial-corrupt-check=true\",\"--experimental-watch-progress-notify-interval=5s\",\"--initial-advertise-peer-urls=https://172.19.0.2:2380\",\"--initial-cluster=v1.30-control-plane=https://172.19.0.2:2380\",\"--key-file=/etc/kubernetes/pki/etcd/server.key\",\"--listen-client-urls=https://127.0.0.1:2379,https://172.19.0.2:2379\",\"--listen-metrics-urls=http://127.0.0.1:2381\",\"--listen-peer-urls=https://172.19.0.2:2380\",\"--name=v1.30-control-plane\",\"--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt\",\"--peer-client-cert-auth=true\",\"--peer-key-file=/etc/kubernetes/pki/etcd/peer.key\",\"--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\",\"--snapshot-count=10000\",\"--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt\"],\"resources\":{\"requests\":{\"cpu\":\"100m\",\"memory\":\"100Mi\"}},\"volumeMounts\":[{\"name\":\"etcd-data\",\"mountPath\":\"/var/lib/etcd\"},{\"name\":\"etcd-certs\",\"mountPath\":\"/etc/kubernetes/pki/etcd\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/health?exclude=NOSPACE\\u0026serializable=true\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/health?serializable=false\",\"port\":2381,\"host\":\"127.0.0.1\",\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:14Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"etcd\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:03Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/etcd:3.5.12-0\",\"imageID\":\"sha256:3861cfcd7c04ccac1f062788eca39487248527ef0c0cfd477a83d7691a75a899\",\"containerID\":\"containerd://a7daffd742cc989ca103ad8de04416c9916573d675d0e81527a9340972a623f9\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kindnet-9974f\",\"generateName\":\"kindnet-\",\"namespace\":\"kube-system\",\"uid\":\"15cb677f-75dc-4eba-9300-9b1d884bbfec\",\"resourceVersion\":\"448\",\"creationTimestamp\":\"2024-04-17T21:58:22Z\",\"labels\":{\"app\":\"kindnet\",\"controller-revision-hash\":\"8bffc7d67\",\"k8s-app\":\"kindnet\",\"pod-template-generation\":\"1\",\"tier\":\"node\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kindnet\",\"uid\":\"5779eeb6-1881-43c1-882f-00656189015f\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:22Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:app\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"5779eeb6-1881-43c1-882f-00656189015f\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kindnet-cni\\\"}\":{\".\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"CONTROL_PLANE_ENDPOINT\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"HOST_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_IP\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}},\"k:{\\\"name\\\":\\\"POD_SUBNET\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{\".\":{},\"f:limits\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\".\":{},\"f:cpu\":{},\"f:memory\":{}}},\"f:securityContext\":{\".\":{},\"f:capabilities\":{\".\":{},\"f:add\":{}},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/cni/net.d\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"cni-cfg\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"cni-cfg\",\"hostPath\":{\"path\":\"/etc/cni/net.d\",\"type\":\"\"}},{\"name\":\"xtables-lock\",\"hostPath\":{\"path\":\"/run/xtables.lock\",\"type\":\"FileOrCreate\"}},{\"name\":\"lib-modules\",\"hostPath\":{\"path\":\"/lib/modules\",\"type\":\"\"}},{\"name\":\"kube-api-access-zvv2z\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"kindnet-cni\",\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"env\":[{\"name\":\"HOST_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.hostIP\"}}},{\"name\":\"POD_IP\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"status.podIP\"}}},{\"name\":\"POD_SUBNET\",\"value\":\"10.244.0.0/16\"},{\"name\":\"CONTROL_PLANE_ENDPOINT\",\"value\":\"v1.30-control-plane:6443\"}],\"resources\":{\"limits\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"},\"requests\":{\"cpu\":\"100m\",\"memory\":\"50Mi\"}},\"volumeMounts\":[{\"name\":\"cni-cfg\",\"mountPath\":\"/etc/cni/net.d\"},{\"name\":\"xtables-lock\",\"mountPath\":\"/run/xtables.lock\"},{\"name\":\"lib-modules\",\"readOnly\":true,\"mountPath\":\"/lib/modules\"},{\"name\":\"kube-api-access-zvv2z\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_RAW\",\"NET_ADMIN\"]},\"privileged\":false}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kindnet\",\"serviceAccount\":\"kindnet\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.30-control-plane\"]}]}]}}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/disk-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/memory-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/pid-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/unschedulable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/network-unavailable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}],\"priority\":0,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:22Z\",\"containerStatuses\":[{\"name\":\"kindnet-cni\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"docker.io/kindest/kindnetd:v20240202-8f1494ea\",\"imageID\":\"sha256:4950bb10b3f87e8d4a8f772a0d8934625cac4ccfa3675fea34cad0dab83fd5a5\",\"containerID\":\"containerd://6b59dfb49698b69018fe8c9fb49f1a60d269b9a696c7f9df25aaa1ab0515d945\",\"started\":true}],\"qosClass\":\"Guaranteed\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-apiserver-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"fda69a5d-714a-4e5e-ad16-8b7a5f6e29c1\",\"resourceVersion\":\"351\",\"creationTimestamp\":\"2024-04-17T21:58:06Z\",\"labels\":{\"component\":\"kube-apiserver\",\"tier\":\"control-plane\"},\"annotations\":{\"kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":\"172.19.0.2:6443\",\"kubernetes.io/config.hash\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.mirror\":\"cde4861fcab84c344c7efe230cabbaed\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:01.064583866Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:06Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-apiserver\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:readinessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:19Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"ca-certs\",\"hostPath\":{\"path\":\"/etc/ssl/certs\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etc-ca-certificates\",\"hostPath\":{\"path\":\"/etc/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"k8s-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-local-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/local/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"kube-apiserver\",\"image\":\"registry.k8s.io/kube-apiserver:v1.30.0\",\"command\":[\"kube-apiserver\",\"--advertise-address=172.19.0.2\",\"--allow-privileged=true\",\"--authorization-mode=Node,RBAC\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--enable-admission-plugins=NodeRestriction\",\"--enable-bootstrap-token-auth=true\",\"--etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt\",\"--etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt\",\"--etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key\",\"--etcd-servers=https://127.0.0.1:2379\",\"--feature-gates=WatchList=true\",\"--kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt\",\"--kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key\",\"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname\",\"--proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt\",\"--proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key\",\"--requestheader-allowed-names=front-proxy-client\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--requestheader-extra-headers-prefix=X-Remote-Extra-\",\"--requestheader-group-headers=X-Remote-Group\",\"--requestheader-username-headers=X-Remote-User\",\"--runtime-config=\",\"--secure-port=6443\",\"--service-account-issuer=https://kubernetes.default.svc.cluster.local\",\"--service-account-key-file=/etc/kubernetes/pki/sa.pub\",\"--service-account-signing-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--tls-cert-file=/etc/kubernetes/pki/apiserver.crt\",\"--tls-private-key-file=/etc/kubernetes/pki/apiserver.key\"],\"resources\":{\"requests\":{\"cpu\":\"250m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"readinessProbe\":{\"httpGet\":{\"path\":\"/readyz\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"timeoutSeconds\":15,\"periodSeconds\":1,\"successThreshold\":1,\"failureThreshold\":3},\"startupProbe\":{\"httpGet\":{\"path\":\"/livez\",\"port\":6443,\"host\":\"172.19.0.2\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:19Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-apiserver\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-apiserver-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:36ff3418ec18184f1aefe275b20f4b1e1681b78bb84c36ef619135e7abf4efa1\",\"containerID\":\"containerd://38e1122b81212fd07f0e3c4e71a8c7ae6da0cf8b3657aa3d1777862587d3214d\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-controller-manager-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"c7c78430-1b31-4448-a652-07941e2d54dd\",\"resourceVersion\":\"345\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"kube-controller-manager\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"a90f961b5236312cebfe37ce2a436436\",\"kubernetes.io/config.mirror\":\"a90f961b5236312cebfe37ce2a436436\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402399245Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-controller-manager\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/controller-manager.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/pki\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/etc/ssl/certs\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/local/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/usr/share/ca-certificates\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"ca-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"etc-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"flexvolume-dir\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"k8s-certs\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-local-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"usr-share-ca-certificates\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"ca-certs\",\"hostPath\":{\"path\":\"/etc/ssl/certs\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"etc-ca-certificates\",\"hostPath\":{\"path\":\"/etc/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"flexvolume-dir\",\"hostPath\":{\"path\":\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"k8s-certs\",\"hostPath\":{\"path\":\"/etc/kubernetes/pki\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"kubeconfig\",\"hostPath\":{\"path\":\"/etc/kubernetes/controller-manager.conf\",\"type\":\"FileOrCreate\"}},{\"name\":\"usr-local-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/local/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}},{\"name\":\"usr-share-ca-certificates\",\"hostPath\":{\"path\":\"/usr/share/ca-certificates\",\"type\":\"DirectoryOrCreate\"}}],\"containers\":[{\"name\":\"kube-controller-manager\",\"image\":\"registry.k8s.io/kube-controller-manager:v1.30.0\",\"command\":[\"kube-controller-manager\",\"--allocate-node-cidrs=true\",\"--authentication-kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--authorization-kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--bind-address=127.0.0.1\",\"--client-ca-file=/etc/kubernetes/pki/ca.crt\",\"--cluster-cidr=10.244.0.0/16\",\"--cluster-name=v1.30\",\"--cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt\",\"--cluster-signing-key-file=/etc/kubernetes/pki/ca.key\",\"--controllers=*,bootstrapsigner,tokencleaner\",\"--enable-hostpath-provisioner=true\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/controller-manager.conf\",\"--leader-elect=true\",\"--requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt\",\"--root-ca-file=/etc/kubernetes/pki/ca.crt\",\"--service-account-private-key-file=/etc/kubernetes/pki/sa.key\",\"--service-cluster-ip-range=10.96.0.0/16\",\"--use-service-account-credentials=true\"],\"resources\":{\"requests\":{\"cpu\":\"200m\"}},\"volumeMounts\":[{\"name\":\"ca-certs\",\"readOnly\":true,\"mountPath\":\"/etc/ssl/certs\"},{\"name\":\"etc-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/etc/ca-certificates\"},{\"name\":\"flexvolume-dir\",\"mountPath\":\"/usr/libexec/kubernetes/kubelet-plugins/volume/exec\"},{\"name\":\"k8s-certs\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/pki\"},{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/controller-manager.conf\"},{\"name\":\"usr-local-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/local/share/ca-certificates\"},{\"name\":\"usr-share-ca-certificates\",\"readOnly\":true,\"mountPath\":\"/usr/share/ca-certificates\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10257,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-controller-manager\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:03Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-controller-manager-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:80d77e09badd17d5dc43178b6f5008d2c7d70a9909a29ef810c1e7d6e8ea6a3f\",\"containerID\":\"containerd://a6ab294d28cf10b0cdd0efa4d5b841a45bb58c26be1aa81874bebcbf9d25fb80\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-proxy-lgcgf\",\"generateName\":\"kube-proxy-\",\"namespace\":\"kube-system\",\"uid\":\"833ebf1d-0efd-4d22-a0b9-b248969f1203\",\"resourceVersion\":\"446\",\"creationTimestamp\":\"2024-04-17T21:58:22Z\",\"labels\":{\"controller-revision-hash\":\"79cf874c65\",\"k8s-app\":\"kube-proxy\",\"pod-template-generation\":\"1\"},\"ownerReferences\":[{\"apiVersion\":\"apps/v1\",\"kind\":\"DaemonSet\",\"name\":\"kube-proxy\",\"uid\":\"96545a93-5c47-4750-b00e-6af439a83f95\",\"controller\":true,\"blockOwnerDeletion\":true}],\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:22Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:generateName\":{},\"f:labels\":{\".\":{},\"f:controller-revision-hash\":{},\"f:k8s-app\":{},\"f:pod-template-generation\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"96545a93-5c47-4750-b00e-6af439a83f95\\\"}\":{}}},\"f:spec\":{\"f:affinity\":{\".\":{},\"f:nodeAffinity\":{\".\":{},\"f:requiredDuringSchedulingIgnoredDuringExecution\":{}}},\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-proxy\\\"}\":{\".\":{},\"f:command\":{},\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"NODE_NAME\\\"}\":{\".\":{},\"f:name\":{},\"f:valueFrom\":{\".\":{},\"f:fieldRef\":{}}}},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:name\":{},\"f:resources\":{},\"f:securityContext\":{\".\":{},\"f:privileged\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/lib/modules\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}},\"k:{\\\"mountPath\\\":\\\"/run/xtables.lock\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}},\"k:{\\\"mountPath\\\":\\\"/var/lib/kube-proxy\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeSelector\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kube-proxy\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:name\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"lib-modules\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}},\"k:{\\\"name\\\":\\\"xtables-lock\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:24Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kube-proxy\",\"configMap\":{\"name\":\"kube-proxy\",\"defaultMode\":420}},{\"name\":\"xtables-lock\",\"hostPath\":{\"path\":\"/run/xtables.lock\",\"type\":\"FileOrCreate\"}},{\"name\":\"lib-modules\",\"hostPath\":{\"path\":\"/lib/modules\",\"type\":\"\"}},{\"name\":\"kube-api-access-mwl8p\",\"projected\":{\"sources\":[{\"serviceAccountToken\":{\"expirationSeconds\":3607,\"path\":\"token\"}},{\"configMap\":{\"name\":\"kube-root-ca.crt\",\"items\":[{\"key\":\"ca.crt\",\"path\":\"ca.crt\"}]}},{\"downwardAPI\":{\"items\":[{\"path\":\"namespace\",\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"metadata.namespace\"}}]}}],\"defaultMode\":420}}],\"containers\":[{\"name\":\"kube-proxy\",\"image\":\"registry.k8s.io/kube-proxy:v1.30.0\",\"command\":[\"/usr/local/bin/kube-proxy\",\"--config=/var/lib/kube-proxy/config.conf\",\"--hostname-override=$(NODE_NAME)\"],\"env\":[{\"name\":\"NODE_NAME\",\"valueFrom\":{\"fieldRef\":{\"apiVersion\":\"v1\",\"fieldPath\":\"spec.nodeName\"}}}],\"resources\":{},\"volumeMounts\":[{\"name\":\"kube-proxy\",\"mountPath\":\"/var/lib/kube-proxy\"},{\"name\":\"xtables-lock\",\"mountPath\":\"/run/xtables.lock\"},{\"name\":\"lib-modules\",\"readOnly\":true,\"mountPath\":\"/lib/modules\"},{\"name\":\"kube-api-access-mwl8p\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\",\"securityContext\":{\"privileged\":true}}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeSelector\":{\"kubernetes.io/os\":\"linux\"},\"serviceAccountName\":\"kube-proxy\",\"serviceAccount\":\"kube-proxy\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{},\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchFields\":[{\"key\":\"metadata.name\",\"operator\":\"In\",\"values\":[\"v1.30-control-plane\"]}]}]}}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\"},{\"key\":\"node.kubernetes.io/not-ready\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/unreachable\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node.kubernetes.io/disk-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/memory-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/pid-pressure\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/unschedulable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"},{\"key\":\"node.kubernetes.io/network-unavailable\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:24Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:22Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:22Z\",\"containerStatuses\":[{\"name\":\"kube-proxy\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:23Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-proxy-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:4cdfd6baac79d10c8154c18ef8451cbfc1b02071fca818730f70a0a0770cb468\",\"containerID\":\"containerd://e7195007bb58050e868013d68ee1a64a0cdbdbc39c5bfed5111479647f04725d\",\"started\":true}],\"qosClass\":\"BestEffort\"}}}\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"kube-scheduler-v1.30-control-plane\",\"namespace\":\"kube-system\",\"uid\":\"78a13980-3d18-444a-810e-7bdd6855cc5b\",\"resourceVersion\":\"347\",\"creationTimestamp\":\"2024-04-17T21:58:07Z\",\"labels\":{\"component\":\"kube-scheduler\",\"tier\":\"control-plane\"},\"annotations\":{\"kubernetes.io/config.hash\":\"fe1777cb28f90924cb0cad5e2fbe52bd\",\"kubernetes.io/config.mirror\":\"fe1777cb28f90924cb0cad5e2fbe52bd\",\"kubernetes.io/config.seen\":\"2024-04-17T21:58:07.402394265Z\",\"kubernetes.io/config.source\":\"file\"},\"ownerReferences\":[{\"apiVersion\":\"v1\",\"kind\":\"Node\",\"name\":\"v1.30-control-plane\",\"uid\":\"c0a30faa-2610-45c7-ad48-9229d615d4c4\",\"controller\":true}],\"managedFields\":[{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:07Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:kubernetes.io/config.hash\":{},\"f:kubernetes.io/config.mirror\":{},\"f:kubernetes.io/config.seen\":{},\"f:kubernetes.io/config.source\":{}},\"f:labels\":{\".\":{},\"f:component\":{},\"f:tier\":{}},\"f:ownerReferences\":{\".\":{},\"k:{\\\"uid\\\":\\\"c0a30faa-2610-45c7-ad48-9229d615d4c4\\\"}\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"kube-scheduler\\\"}\":{\".\":{},\"f:command\":{},\"f:image\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:name\":{},\"f:resources\":{\".\":{},\"f:requests\":{\".\":{},\"f:cpu\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:host\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/etc/kubernetes/scheduler.conf\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:readOnly\":{}}}}},\"f:dnsPolicy\":{},\"f:enableServiceLinks\":{},\"f:hostNetwork\":{},\"f:nodeName\":{},\"f:priority\":{},\"f:priorityClassName\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{\".\":{},\"f:seccompProfile\":{\".\":{},\"f:type\":{}}},\"f:terminationGracePeriodSeconds\":{},\"f:tolerations\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"kubeconfig\\\"}\":{\".\":{},\"f:hostPath\":{\".\":{},\"f:path\":{},\"f:type\":{}},\"f:name\":{}}}}}},{\"manager\":\"kubelet\",\"operation\":\"Update\",\"apiVersion\":\"v1\",\"time\":\"2024-04-17T21:58:18Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:status\":{\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"ContainersReady\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Initialized\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodReadyToStartContainers\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"PodScheduled\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Ready\\\"}\":{\".\":{},\"f:lastProbeTime\":{},\"f:lastTransitionTime\":{},\"f:status\":{},\"f:type\":{}}},\"f:containerStatuses\":{},\"f:hostIP\":{},\"f:hostIPs\":{},\"f:phase\":{},\"f:podIP\":{},\"f:podIPs\":{\".\":{},\"k:{\\\"ip\\\":\\\"172.19.0.2\\\"}\":{\".\":{},\"f:ip\":{}}},\"f:startTime\":{}}},\"subresource\":\"status\"}]},\"spec\":{\"volumes\":[{\"name\":\"kubeconfig\",\"hostPath\":{\"path\":\"/etc/kubernetes/scheduler.conf\",\"type\":\"FileOrCreate\"}}],\"containers\":[{\"name\":\"kube-scheduler\",\"image\":\"registry.k8s.io/kube-scheduler:v1.30.0\",\"command\":[\"kube-scheduler\",\"--authentication-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--authorization-kubeconfig=/etc/kubernetes/scheduler.conf\",\"--bind-address=127.0.0.1\",\"--feature-gates=WatchList=true\",\"--kubeconfig=/etc/kubernetes/scheduler.conf\",\"--leader-elect=true\"],\"resources\":{\"requests\":{\"cpu\":\"100m\"}},\"volumeMounts\":[{\"name\":\"kubeconfig\",\"readOnly\":true,\"mountPath\":\"/etc/kubernetes/scheduler.conf\"}],\"livenessProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":8},\"startupProbe\":{\"httpGet\":{\"path\":\"/healthz\",\"port\":10259,\"host\":\"127.0.0.1\",\"scheme\":\"HTTPS\"},\"initialDelaySeconds\":10,\"timeoutSeconds\":15,\"periodSeconds\":10,\"successThreshold\":1,\"failureThreshold\":24},\"terminationMessagePath\":\"/dev/termination-log\",\"terminationMessagePolicy\":\"File\",\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Always\",\"terminationGracePeriodSeconds\":30,\"dnsPolicy\":\"ClusterFirst\",\"nodeName\":\"v1.30-control-plane\",\"hostNetwork\":true,\"securityContext\":{\"seccompProfile\":{\"type\":\"RuntimeDefault\"}},\"schedulerName\":\"default-scheduler\",\"tolerations\":[{\"operator\":\"Exists\",\"effect\":\"NoExecute\"}],\"priorityClassName\":\"system-node-critical\",\"priority\":2000001000,\"enableServiceLinks\":true,\"preemptionPolicy\":\"PreemptLowerPriority\"},\"status\":{\"phase\":\"Running\",\"conditions\":[{\"type\":\"PodReadyToStartContainers\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Initialized\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"},{\"type\":\"Ready\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"ContainersReady\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:18Z\"},{\"type\":\"PodScheduled\",\"status\":\"True\",\"lastProbeTime\":null,\"lastTransitionTime\":\"2024-04-17T21:58:07Z\"}],\"hostIP\":\"172.19.0.2\",\"hostIPs\":[{\"ip\":\"172.19.0.2\"}],\"podIP\":\"172.19.0.2\",\"podIPs\":[{\"ip\":\"172.19.0.2\"}],\"startTime\":\"2024-04-17T21:58:07Z\",\"containerStatuses\":[{\"name\":\"kube-scheduler\",\"state\":{\"running\":{\"startedAt\":\"2024-04-17T21:58:02Z\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"registry.k8s.io/kube-scheduler-amd64:v1.30.0\",\"imageID\":\"docker.io/library/import-2024-04-17@sha256:34efc4f308e6dae9c0b59d77442866d9731340a5af4c42f196840cb0206cf2f5\",\"containerID\":\"containerd://64f67c5d5390f3fd6c2f266e7ba966bb3167a353bcfa160bab0e79478dc67277\",\"started\":true}],\"qosClass\":\"Burstable\"}}}\n{\"type\":\"BOOKMARK\",\"object\":{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"resourceVersion\":\"605\",\"creationTimestamp\":null,\"annotations\":{\"k8s.io/initial-events-end\":\"true\"}},\"spec\":{\"containers\":null},\"status\":{}}}\n" + } +] diff --git a/src/lib.rs b/src/lib.rs index 739c9c447..68133d4eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ #![cfg_attr(k8s_openapi_enabled_version="1.27", doc = "v1_27")] #![cfg_attr(k8s_openapi_enabled_version="1.28", doc = "v1_28")] #![cfg_attr(k8s_openapi_enabled_version="1.29", doc = "v1_29")] +#![cfg_attr(k8s_openapi_enabled_version="1.30", doc = "v1_30")] //! ` feature enabled. To see docs for one of the other supported versions, please generate the docs locally with `cargo doc --features 'v1_<>'` //! @@ -266,4 +267,7 @@ pub use _resource::{ #[cfg(k8s_openapi_enabled_version="1.29")] mod v1_29; #[cfg(k8s_openapi_enabled_version="1.29")] pub use self::v1_29::*; +#[cfg(k8s_openapi_enabled_version="1.30")] mod v1_30; +#[cfg(k8s_openapi_enabled_version="1.30")] pub use self::v1_30::*; + include!(concat!(env!("OUT_DIR"), "/conditional_compilation_macros.rs")); diff --git a/src/v1_30/api/admissionregistration/mod.rs b/src/v1_30/api/admissionregistration/mod.rs new file mode 100644 index 000000000..ab259273f --- /dev/null +++ b/src/v1_30/api/admissionregistration/mod.rs @@ -0,0 +1,5 @@ +pub mod v1; + +pub mod v1alpha1; + +pub mod v1beta1; diff --git a/src/v1_30/api/admissionregistration/v1/audit_annotation.rs b/src/v1_30/api/admissionregistration/v1/audit_annotation.rs new file mode 100644 index 000000000..ac40b0b3e --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/audit_annotation.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.AuditAnnotation + +/// AuditAnnotation describes how to produce an audit annotation for an API request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AuditAnnotation { + /// key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name (\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*) no more than 63 bytes in length. + /// + /// The key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: "{ValidatingAdmissionPolicy name}/{key}". + /// + /// If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded. + /// + /// Required. + pub key: String, + + /// valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb. + /// + /// If multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list. + /// + /// Required. + pub value_expression: String, +} + +impl crate::DeepMerge for AuditAnnotation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.value_expression, other.value_expression); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AuditAnnotation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_value_expression, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "valueExpression" => Field::Key_value_expression, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AuditAnnotation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AuditAnnotation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_value_expression: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value_expression => value_value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AuditAnnotation { + key: value_key.unwrap_or_default(), + value_expression: value_value_expression.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AuditAnnotation", + &[ + "key", + "valueExpression", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AuditAnnotation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AuditAnnotation", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "valueExpression", &self.value_expression)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AuditAnnotation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.AuditAnnotation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AuditAnnotation describes how to produce an audit annotation for an API request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.\n\nThe key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: \"{ValidatingAdmissionPolicy name}/{key}\".\n\nIf an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "valueExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb.\n\nIf multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "valueExpression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/expression_warning.rs b/src/v1_30/api/admissionregistration/v1/expression_warning.rs new file mode 100644 index 000000000..b6cc1da62 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/expression_warning.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ExpressionWarning + +/// ExpressionWarning is a warning information that targets a specific expression. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExpressionWarning { + /// The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is "spec.validations\[0\].expression" + pub field_ref: String, + + /// The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler. + pub warning: String, +} + +impl crate::DeepMerge for ExpressionWarning { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field_ref, other.field_ref); + crate::DeepMerge::merge_from(&mut self.warning, other.warning); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExpressionWarning { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field_ref, + Key_warning, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fieldRef" => Field::Key_field_ref, + "warning" => Field::Key_warning, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExpressionWarning; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExpressionWarning") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field_ref: Option = None; + let mut value_warning: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field_ref => value_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_warning => value_warning = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExpressionWarning { + field_ref: value_field_ref.unwrap_or_default(), + warning: value_warning.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ExpressionWarning", + &[ + "fieldRef", + "warning", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExpressionWarning { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExpressionWarning", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldRef", &self.field_ref)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "warning", &self.warning)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExpressionWarning { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ExpressionWarning".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExpressionWarning is a warning information that targets a specific expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fieldRef".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "warning".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "fieldRef".to_owned(), + "warning".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/match_condition.rs b/src/v1_30/api/admissionregistration/v1/match_condition.rs new file mode 100644 index 000000000..46495d9d3 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/match_condition.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.MatchCondition + +/// MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchCondition { + /// Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: + /// + /// 'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/ + /// + /// Required. + pub expression: String, + + /// Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '(\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*)?\[A-Za-z0-9\]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName') + /// + /// Required. + pub name: String, +} + +impl crate::DeepMerge for MatchCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchCondition { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MatchCondition", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchCondition", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchCondition { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.MatchCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/match_resources.rs b/src/v1_30/api/admissionregistration/v1/match_resources.rs new file mode 100644 index 000000000..20fe7244a --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/match_resources.rs @@ -0,0 +1,271 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.MatchResources + +/// MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchResources { + /// ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) + pub exclude_resource_rules: Option>, + + /// matchPolicy defines how the "MatchResources" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + /// + /// - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy. + /// + /// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy. + /// + /// Defaults to "Equivalent" + pub match_policy: Option, + + /// NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy. + /// + /// For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "runlevel", + /// "operator": "NotIn", + /// "values": \[ + /// "0", + /// "1" + /// \] + /// } + /// \] + /// } + /// + /// If instead you want to only run the policy on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "environment", + /// "operator": "In", + /// "values": \[ + /// "prod", + /// "staging" + /// \] + /// } + /// \] + /// } + /// + /// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. + /// + /// Default to the empty LabelSelector, which matches everything. + pub namespace_selector: Option, + + /// ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + pub object_selector: Option, + + /// ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule. + pub resource_rules: Option>, +} + +impl crate::DeepMerge for MatchResources { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.exclude_resource_rules, other.exclude_resource_rules); + crate::DeepMerge::merge_from(&mut self.match_policy, other.match_policy); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.object_selector, other.object_selector); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchResources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exclude_resource_rules, + Key_match_policy, + Key_namespace_selector, + Key_object_selector, + Key_resource_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "excludeResourceRules" => Field::Key_exclude_resource_rules, + "matchPolicy" => Field::Key_match_policy, + "namespaceSelector" => Field::Key_namespace_selector, + "objectSelector" => Field::Key_object_selector, + "resourceRules" => Field::Key_resource_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchResources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchResources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exclude_resource_rules: Option> = None; + let mut value_match_policy: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_object_selector: Option = None; + let mut value_resource_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exclude_resource_rules => value_exclude_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_policy => value_match_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object_selector => value_object_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchResources { + exclude_resource_rules: value_exclude_resource_rules, + match_policy: value_match_policy, + namespace_selector: value_namespace_selector, + object_selector: value_object_selector, + resource_rules: value_resource_rules, + }) + } + } + + deserializer.deserialize_struct( + "MatchResources", + &[ + "excludeResourceRules", + "matchPolicy", + "namespaceSelector", + "objectSelector", + "resourceRules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchResources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchResources", + self.exclude_resource_rules.as_ref().map_or(0, |_| 1) + + self.match_policy.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.object_selector.as_ref().map_or(0, |_| 1) + + self.resource_rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exclude_resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "excludeResourceRules", value)?; + } + if let Some(value) = &self.match_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchPolicy", value)?; + } + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.object_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "objectSelector", value)?; + } + if let Some(value) = &self.resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchResources { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.MatchResources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "excludeResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.\n\nDefaults to \"Equivalent\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "objectSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/mod.rs b/src/v1_30/api/admissionregistration/v1/mod.rs new file mode 100644 index 000000000..0e6d6f0d5 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/mod.rs @@ -0,0 +1,66 @@ + +mod audit_annotation; +pub use self::audit_annotation::AuditAnnotation; + +mod expression_warning; +pub use self::expression_warning::ExpressionWarning; + +mod match_condition; +pub use self::match_condition::MatchCondition; + +mod match_resources; +pub use self::match_resources::MatchResources; + +mod mutating_webhook; +pub use self::mutating_webhook::MutatingWebhook; + +mod mutating_webhook_configuration; +pub use self::mutating_webhook_configuration::MutatingWebhookConfiguration; + +mod named_rule_with_operations; +pub use self::named_rule_with_operations::NamedRuleWithOperations; + +mod param_kind; +pub use self::param_kind::ParamKind; + +mod param_ref; +pub use self::param_ref::ParamRef; + +mod rule_with_operations; +pub use self::rule_with_operations::RuleWithOperations; + +mod service_reference; +pub use self::service_reference::ServiceReference; + +mod type_checking; +pub use self::type_checking::TypeChecking; + +mod validating_admission_policy; +pub use self::validating_admission_policy::ValidatingAdmissionPolicy; + +mod validating_admission_policy_binding; +pub use self::validating_admission_policy_binding::ValidatingAdmissionPolicyBinding; + +mod validating_admission_policy_binding_spec; +pub use self::validating_admission_policy_binding_spec::ValidatingAdmissionPolicyBindingSpec; + +mod validating_admission_policy_spec; +pub use self::validating_admission_policy_spec::ValidatingAdmissionPolicySpec; + +mod validating_admission_policy_status; +pub use self::validating_admission_policy_status::ValidatingAdmissionPolicyStatus; + +mod validating_webhook; +pub use self::validating_webhook::ValidatingWebhook; + +mod validating_webhook_configuration; +pub use self::validating_webhook_configuration::ValidatingWebhookConfiguration; + +mod validation; +pub use self::validation::Validation; + +mod variable; +pub use self::variable::Variable; + +mod webhook_client_config; +pub use self::webhook_client_config::WebhookClientConfig; diff --git a/src/v1_30/api/admissionregistration/v1/mutating_webhook.rs b/src/v1_30/api/admissionregistration/v1/mutating_webhook.rs new file mode 100644 index 000000000..b52829fd2 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/mutating_webhook.rs @@ -0,0 +1,471 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.MutatingWebhook + +/// MutatingWebhook describes an admission webhook and the resources and operations it applies to. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MutatingWebhook { + /// AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. + pub admission_review_versions: Vec, + + /// ClientConfig defines how to communicate with the hook. Required + pub client_config: crate::api::admissionregistration::v1::WebhookClientConfig, + + /// FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail. + pub failure_policy: Option, + + /// MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. + /// + /// The exact matching logic is (in order): + /// 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped. + /// 2. If ALL matchConditions evaluate to TRUE, the webhook is called. + /// 3. If any matchCondition evaluates to an error (but none are FALSE): + /// - If failurePolicy=Fail, reject the request + /// - If failurePolicy=Ignore, the error is ignored and the webhook is skipped + pub match_conditions: Option>, + + /// matchPolicy defines how the "rules" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + /// + /// - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + /// + /// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + /// + /// Defaults to "Equivalent" + pub match_policy: Option, + + /// The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where "imagepolicy" is the name of the webhook, and kubernetes.io is the name of the organization. Required. + pub name: String, + + /// NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. + /// + /// For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "runlevel", + /// "operator": "NotIn", + /// "values": \[ + /// "0", + /// "1" + /// \] + /// } + /// \] + /// } + /// + /// If instead you want to only run the webhook on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "environment", + /// "operator": "In", + /// "values": \[ + /// "prod", + /// "staging" + /// \] + /// } + /// \] + /// } + /// + /// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. + /// + /// Default to the empty LabelSelector, which matches everything. + pub namespace_selector: Option, + + /// ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + pub object_selector: Option, + + /// reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are "Never" and "IfNeeded". + /// + /// Never: the webhook will not be called more than once in a single admission evaluation. + /// + /// IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead. + /// + /// Defaults to "Never". + pub reinvocation_policy: Option, + + /// Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + pub rules: Option>, + + /// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. + pub side_effects: String, + + /// TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds. + pub timeout_seconds: Option, +} + +impl crate::DeepMerge for MutatingWebhook { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.admission_review_versions, other.admission_review_versions); + crate::DeepMerge::merge_from(&mut self.client_config, other.client_config); + crate::DeepMerge::merge_from(&mut self.failure_policy, other.failure_policy); + crate::merge_strategies::list::map( + &mut self.match_conditions, + other.match_conditions, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.match_policy, other.match_policy); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.object_selector, other.object_selector); + crate::DeepMerge::merge_from(&mut self.reinvocation_policy, other.reinvocation_policy); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + crate::DeepMerge::merge_from(&mut self.side_effects, other.side_effects); + crate::DeepMerge::merge_from(&mut self.timeout_seconds, other.timeout_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MutatingWebhook { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_admission_review_versions, + Key_client_config, + Key_failure_policy, + Key_match_conditions, + Key_match_policy, + Key_name, + Key_namespace_selector, + Key_object_selector, + Key_reinvocation_policy, + Key_rules, + Key_side_effects, + Key_timeout_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "admissionReviewVersions" => Field::Key_admission_review_versions, + "clientConfig" => Field::Key_client_config, + "failurePolicy" => Field::Key_failure_policy, + "matchConditions" => Field::Key_match_conditions, + "matchPolicy" => Field::Key_match_policy, + "name" => Field::Key_name, + "namespaceSelector" => Field::Key_namespace_selector, + "objectSelector" => Field::Key_object_selector, + "reinvocationPolicy" => Field::Key_reinvocation_policy, + "rules" => Field::Key_rules, + "sideEffects" => Field::Key_side_effects, + "timeoutSeconds" => Field::Key_timeout_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MutatingWebhook; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MutatingWebhook") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_admission_review_versions: Option> = None; + let mut value_client_config: Option = None; + let mut value_failure_policy: Option = None; + let mut value_match_conditions: Option> = None; + let mut value_match_policy: Option = None; + let mut value_name: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_object_selector: Option = None; + let mut value_reinvocation_policy: Option = None; + let mut value_rules: Option> = None; + let mut value_side_effects: Option = None; + let mut value_timeout_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_admission_review_versions => value_admission_review_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_client_config => value_client_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_policy => value_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_conditions => value_match_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_policy => value_match_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object_selector => value_object_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reinvocation_policy => value_reinvocation_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_side_effects => value_side_effects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_timeout_seconds => value_timeout_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MutatingWebhook { + admission_review_versions: value_admission_review_versions.unwrap_or_default(), + client_config: value_client_config.unwrap_or_default(), + failure_policy: value_failure_policy, + match_conditions: value_match_conditions, + match_policy: value_match_policy, + name: value_name.unwrap_or_default(), + namespace_selector: value_namespace_selector, + object_selector: value_object_selector, + reinvocation_policy: value_reinvocation_policy, + rules: value_rules, + side_effects: value_side_effects.unwrap_or_default(), + timeout_seconds: value_timeout_seconds, + }) + } + } + + deserializer.deserialize_struct( + "MutatingWebhook", + &[ + "admissionReviewVersions", + "clientConfig", + "failurePolicy", + "matchConditions", + "matchPolicy", + "name", + "namespaceSelector", + "objectSelector", + "reinvocationPolicy", + "rules", + "sideEffects", + "timeoutSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MutatingWebhook { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MutatingWebhook", + 4 + + self.failure_policy.as_ref().map_or(0, |_| 1) + + self.match_conditions.as_ref().map_or(0, |_| 1) + + self.match_policy.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.object_selector.as_ref().map_or(0, |_| 1) + + self.reinvocation_policy.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1) + + self.timeout_seconds.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "admissionReviewVersions", &self.admission_review_versions)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clientConfig", &self.client_config)?; + if let Some(value) = &self.failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failurePolicy", value)?; + } + if let Some(value) = &self.match_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConditions", value)?; + } + if let Some(value) = &self.match_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchPolicy", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.object_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "objectSelector", value)?; + } + if let Some(value) = &self.reinvocation_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reinvocationPolicy", value)?; + } + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sideEffects", &self.side_effects)?; + if let Some(value) = &self.timeout_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeoutSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MutatingWebhook { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.MutatingWebhook".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MutatingWebhook describes an admission webhook and the resources and operations it applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "admissionReviewVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "clientConfig".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClientConfig defines how to communicate with the hook. Required".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "failurePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "matchConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Equivalent\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "objectSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "reinvocationPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".\n\nNever: the webhook will not be called more than once in a single admission evaluation.\n\nIfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.\n\nDefaults to \"Never\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "sideEffects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "timeoutSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "admissionReviewVersions".to_owned(), + "clientConfig".to_owned(), + "name".to_owned(), + "sideEffects".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/mutating_webhook_configuration.rs b/src/v1_30/api/admissionregistration/v1/mutating_webhook_configuration.rs new file mode 100644 index 000000000..f2635a13e --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/mutating_webhook_configuration.rs @@ -0,0 +1,231 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration + +/// MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MutatingWebhookConfiguration { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Webhooks is a list of webhooks and the affected resources and operations. + pub webhooks: Option>, +} + +impl crate::Resource for MutatingWebhookConfiguration { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "MutatingWebhookConfiguration"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "mutatingwebhookconfigurations"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for MutatingWebhookConfiguration { + const LIST_KIND: &'static str = "MutatingWebhookConfigurationList"; +} + +impl crate::Metadata for MutatingWebhookConfiguration { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for MutatingWebhookConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::map( + &mut self.webhooks, + other.webhooks, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MutatingWebhookConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_webhooks, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "webhooks" => Field::Key_webhooks, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MutatingWebhookConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_webhooks: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_webhooks => value_webhooks = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MutatingWebhookConfiguration { + metadata: value_metadata.unwrap_or_default(), + webhooks: value_webhooks, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "webhooks", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MutatingWebhookConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.webhooks.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.webhooks { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "webhooks", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MutatingWebhookConfiguration { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "webhooks".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Webhooks is a list of webhooks and the affected resources and operations.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/named_rule_with_operations.rs b/src/v1_30/api/admissionregistration/v1/named_rule_with_operations.rs new file mode 100644 index 000000000..d412de6a6 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/named_rule_with_operations.rs @@ -0,0 +1,303 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.NamedRuleWithOperations + +/// NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedRuleWithOperations { + /// APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required. + pub api_groups: Option>, + + /// APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required. + pub api_versions: Option>, + + /// Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. + pub operations: Option>, + + /// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + pub resource_names: Option>, + + /// Resources is a list of resources this rule applies to. + /// + /// For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources. + /// + /// If wildcard is present, the validation rule will ensure resources do not overlap with each other. + /// + /// Depending on the enclosing object, subresources might not be allowed. Required. + pub resources: Option>, + + /// scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "*" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "*" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". + pub scope: Option, +} + +impl crate::DeepMerge for NamedRuleWithOperations { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.api_versions, other.api_versions); + crate::merge_strategies::list::atomic(&mut self.operations, other.operations); + crate::merge_strategies::list::atomic(&mut self.resource_names, other.resource_names); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedRuleWithOperations { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_api_versions, + Key_operations, + Key_resource_names, + Key_resources, + Key_scope, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "apiVersions" => Field::Key_api_versions, + "operations" => Field::Key_operations, + "resourceNames" => Field::Key_resource_names, + "resources" => Field::Key_resources, + "scope" => Field::Key_scope, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedRuleWithOperations; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedRuleWithOperations") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_api_versions: Option> = None; + let mut value_operations: Option> = None; + let mut value_resource_names: Option> = None; + let mut value_resources: Option> = None; + let mut value_scope: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_api_versions => value_api_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operations => value_operations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_names => value_resource_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedRuleWithOperations { + api_groups: value_api_groups, + api_versions: value_api_versions, + operations: value_operations, + resource_names: value_resource_names, + resources: value_resources, + scope: value_scope, + }) + } + } + + deserializer.deserialize_struct( + "NamedRuleWithOperations", + &[ + "apiGroups", + "apiVersions", + "operations", + "resourceNames", + "resources", + "scope", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedRuleWithOperations { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedRuleWithOperations", + self.api_groups.as_ref().map_or(0, |_| 1) + + self.api_versions.as_ref().map_or(0, |_| 1) + + self.operations.as_ref().map_or(0, |_| 1) + + self.resource_names.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.scope.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.api_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersions", value)?; + } + if let Some(value) = &self.operations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operations", value)?; + } + if let Some(value) = &self.resource_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceNames", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedRuleWithOperations { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.NamedRuleWithOperations".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "apiVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "operations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope specifies the scope of this rule. Valid values are \"Cluster\", \"Namespaced\", and \"*\" \"Cluster\" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. \"Namespaced\" means that only namespaced resources will match this rule. \"*\" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is \"*\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/param_kind.rs b/src/v1_30/api/admissionregistration/v1/param_kind.rs new file mode 100644 index 000000000..c145cda27 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/param_kind.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ParamKind + +/// ParamKind is a tuple of Group Kind and Version. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamKind { + /// APIVersion is the API group version the resources belong to. In format of "group/version". Required. + pub api_version: Option, + + /// Kind is the API kind the resources belong to. Required. + pub kind: Option, +} + +impl crate::DeepMerge for ParamKind { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamKind { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamKind; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamKind") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamKind { + api_version: value_api_version, + kind: value_kind, + }) + } + } + + deserializer.deserialize_struct( + "ParamKind", + &[ + "apiVersion", + "kind", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamKind { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamKind", + self.api_version.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamKind { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ParamKind".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind is a tuple of Group Kind and Version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the API kind the resources belong to. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/param_ref.rs b/src/v1_30/api/admissionregistration/v1/param_ref.rs new file mode 100644 index 000000000..cd65d07a4 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/param_ref.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ParamRef + +/// ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamRef { + /// name is the name of the resource being referenced. + /// + /// One of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + /// + /// A single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped. + pub name: Option, + + /// namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields. + /// + /// A per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty. + /// + /// - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error. + /// + /// - If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error. + pub namespace: Option, + + /// `parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy. + /// + /// Allowed values are `Allow` or `Deny` + /// + /// Required + pub parameter_not_found_action: Option, + + /// selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind. + /// + /// If multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together. + /// + /// One of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + pub selector: Option, +} + +impl crate::DeepMerge for ParamRef { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.parameter_not_found_action, other.parameter_not_found_action); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamRef { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_parameter_not_found_action, + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "parameterNotFoundAction" => Field::Key_parameter_not_found_action, + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamRef; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamRef") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_parameter_not_found_action: Option = None; + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameter_not_found_action => value_parameter_not_found_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamRef { + name: value_name, + namespace: value_namespace, + parameter_not_found_action: value_parameter_not_found_action, + selector: value_selector, + }) + } + } + + deserializer.deserialize_struct( + "ParamRef", + &[ + "name", + "namespace", + "parameterNotFoundAction", + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamRef { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamRef", + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.parameter_not_found_action.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.parameter_not_found_action { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameterNotFoundAction", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamRef { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ParamRef".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource being referenced.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.\n\nA single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parameterNotFoundAction".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/rule_with_operations.rs b/src/v1_30/api/admissionregistration/v1/rule_with_operations.rs new file mode 100644 index 000000000..441b9ab3f --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/rule_with_operations.rs @@ -0,0 +1,269 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.RuleWithOperations + +/// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RuleWithOperations { + /// APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required. + pub api_groups: Option>, + + /// APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required. + pub api_versions: Option>, + + /// Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. + pub operations: Option>, + + /// Resources is a list of resources this rule applies to. + /// + /// For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources. + /// + /// If wildcard is present, the validation rule will ensure resources do not overlap with each other. + /// + /// Depending on the enclosing object, subresources might not be allowed. Required. + pub resources: Option>, + + /// scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "*" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "*" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". + pub scope: Option, +} + +impl crate::DeepMerge for RuleWithOperations { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.api_versions, other.api_versions); + crate::merge_strategies::list::atomic(&mut self.operations, other.operations); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RuleWithOperations { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_api_versions, + Key_operations, + Key_resources, + Key_scope, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "apiVersions" => Field::Key_api_versions, + "operations" => Field::Key_operations, + "resources" => Field::Key_resources, + "scope" => Field::Key_scope, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RuleWithOperations; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RuleWithOperations") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_api_versions: Option> = None; + let mut value_operations: Option> = None; + let mut value_resources: Option> = None; + let mut value_scope: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_api_versions => value_api_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operations => value_operations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RuleWithOperations { + api_groups: value_api_groups, + api_versions: value_api_versions, + operations: value_operations, + resources: value_resources, + scope: value_scope, + }) + } + } + + deserializer.deserialize_struct( + "RuleWithOperations", + &[ + "apiGroups", + "apiVersions", + "operations", + "resources", + "scope", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RuleWithOperations { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RuleWithOperations", + self.api_groups.as_ref().map_or(0, |_| 1) + + self.api_versions.as_ref().map_or(0, |_| 1) + + self.operations.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.scope.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.api_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersions", value)?; + } + if let Some(value) = &self.operations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operations", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RuleWithOperations { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.RuleWithOperations".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "apiVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "operations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope specifies the scope of this rule. Valid values are \"Cluster\", \"Namespaced\", and \"*\" \"Cluster\" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. \"Namespaced\" means that only namespaced resources will match this rule. \"*\" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is \"*\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/service_reference.rs b/src/v1_30/api/admissionregistration/v1/service_reference.rs new file mode 100644 index 000000000..a3c392ec3 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/service_reference.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ServiceReference + +/// ServiceReference holds a reference to Service.legacy.k8s.io +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceReference { + /// `name` is the name of the service. Required + pub name: String, + + /// `namespace` is the namespace of the service. Required + pub namespace: String, + + /// `path` is an optional URL path which will be sent in any request to this service. + pub path: Option, + + /// If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + pub port: Option, +} + +impl crate::DeepMerge for ServiceReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_path, + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "path" => Field::Key_path, + "port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_path: Option = None; + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceReference { + name: value_name.unwrap_or_default(), + namespace: value_namespace.unwrap_or_default(), + path: value_path, + port: value_port, + }) + } + } + + deserializer.deserialize_struct( + "ServiceReference", + &[ + "name", + "namespace", + "path", + "port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceReference", + 2 + + self.path.as_ref().map_or(0, |_| 1) + + self.port.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", &self.namespace)?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceReference { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ServiceReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceReference holds a reference to Service.legacy.k8s.io".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of the service. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`namespace` is the namespace of the service. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`path` is an optional URL path which will be sent in any request to this service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "namespace".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/type_checking.rs b/src/v1_30/api/admissionregistration/v1/type_checking.rs new file mode 100644 index 000000000..a8970e296 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/type_checking.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.TypeChecking + +/// TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TypeChecking { + /// The type checking warnings for each expression. + pub expression_warnings: Option>, +} + +impl crate::DeepMerge for TypeChecking { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.expression_warnings, other.expression_warnings); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TypeChecking { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression_warnings, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expressionWarnings" => Field::Key_expression_warnings, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TypeChecking; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TypeChecking") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression_warnings: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression_warnings => value_expression_warnings = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TypeChecking { + expression_warnings: value_expression_warnings, + }) + } + } + + deserializer.deserialize_struct( + "TypeChecking", + &[ + "expressionWarnings", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TypeChecking { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TypeChecking", + self.expression_warnings.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.expression_warnings { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expressionWarnings", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TypeChecking { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.TypeChecking".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expressionWarnings".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The type checking warnings for each expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_admission_policy.rs b/src/v1_30/api/admissionregistration/v1/validating_admission_policy.rs new file mode 100644 index 000000000..c337042d6 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_admission_policy.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicy + +/// ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicy { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicy. + pub spec: Option, + + /// The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only. + pub status: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicy { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicy"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicies"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicy { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicy { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicy { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicy { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicy.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding.rs b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding.rs new file mode 100644 index 000000000..6fac22d84 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding.rs @@ -0,0 +1,224 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyBinding + +/// ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters. +/// +/// For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. +/// +/// The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBinding { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + pub spec: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicyBinding { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicyBinding"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicybindings"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicyBinding { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyBindingList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicyBinding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBinding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBinding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBinding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBinding { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBinding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBinding { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyBinding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding_spec.rs b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding_spec.rs new file mode 100644 index 000000000..ad4ffbc0f --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_binding_spec.rs @@ -0,0 +1,229 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyBindingSpec + +/// ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBindingSpec { + /// MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required. + pub match_resources: Option, + + /// paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + pub param_ref: Option, + + /// PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required. + pub policy_name: Option, + + /// validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions. + /// + /// Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy. + /// + /// validationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action. + /// + /// The supported actions values are: + /// + /// "Deny" specifies that a validation failure results in a denied request. + /// + /// "Warn" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses. + /// + /// "Audit" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `"validation.policy.admission.k8s.io/validation_failure": "\[{"message": "Invalid value", {"policy": "policy.example.com", {"binding": "policybinding.example.com", {"expressionIndex": "1", {"validationActions": \["Audit"\]}\]"` + /// + /// Clients should expect to handle additional values by ignoring any values not recognized. + /// + /// "Deny" and "Warn" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers. + /// + /// Required. + pub validation_actions: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBindingSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.match_resources, other.match_resources); + crate::DeepMerge::merge_from(&mut self.param_ref, other.param_ref); + crate::DeepMerge::merge_from(&mut self.policy_name, other.policy_name); + crate::merge_strategies::list::set(&mut self.validation_actions, other.validation_actions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBindingSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_resources, + Key_param_ref, + Key_policy_name, + Key_validation_actions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchResources" => Field::Key_match_resources, + "paramRef" => Field::Key_param_ref, + "policyName" => Field::Key_policy_name, + "validationActions" => Field::Key_validation_actions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBindingSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyBindingSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_resources: Option = None; + let mut value_param_ref: Option = None; + let mut value_policy_name: Option = None; + let mut value_validation_actions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_resources => value_match_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_ref => value_param_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_policy_name => value_policy_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validation_actions => value_validation_actions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBindingSpec { + match_resources: value_match_resources, + param_ref: value_param_ref, + policy_name: value_policy_name, + validation_actions: value_validation_actions, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + &[ + "matchResources", + "paramRef", + "policyName", + "validationActions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBindingSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + self.match_resources.as_ref().map_or(0, |_| 1) + + self.param_ref.as_ref().map_or(0, |_| 1) + + self.policy_name.as_ref().map_or(0, |_| 1) + + self.validation_actions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchResources", value)?; + } + if let Some(value) = &self.param_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramRef", value)?; + } + if let Some(value) = &self.policy_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "policyName", value)?; + } + if let Some(value) = &self.validation_actions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validationActions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBindingSpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyBindingSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "policyName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "validationActions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_admission_policy_spec.rs b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_spec.rs new file mode 100644 index 000000000..172939fca --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_spec.rs @@ -0,0 +1,326 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicySpec + +/// ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicySpec { + /// auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required. + pub audit_annotations: Option>, + + /// failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings. + /// + /// A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource. + /// + /// failurePolicy does not define how validations that evaluate to false are handled. + /// + /// When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced. + /// + /// Allowed values are Ignore or Fail. Defaults to Fail. + pub failure_policy: Option, + + /// MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. + /// + /// If a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions. + /// + /// The exact matching logic is (in order): + /// 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + /// 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + /// 3. If any matchCondition evaluates to an error (but none are FALSE): + /// - If failurePolicy=Fail, reject the request + /// - If failurePolicy=Ignore, the policy is skipped + pub match_conditions: Option>, + + /// MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required. + pub match_constraints: Option, + + /// ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. + pub param_kind: Option, + + /// Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required. + pub validations: Option>, + + /// Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy. + /// + /// The expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic. + pub variables: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicySpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audit_annotations, other.audit_annotations); + crate::DeepMerge::merge_from(&mut self.failure_policy, other.failure_policy); + crate::merge_strategies::list::map( + &mut self.match_conditions, + other.match_conditions, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.match_constraints, other.match_constraints); + crate::DeepMerge::merge_from(&mut self.param_kind, other.param_kind); + crate::merge_strategies::list::atomic(&mut self.validations, other.validations); + crate::merge_strategies::list::map( + &mut self.variables, + other.variables, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicySpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audit_annotations, + Key_failure_policy, + Key_match_conditions, + Key_match_constraints, + Key_param_kind, + Key_validations, + Key_variables, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "auditAnnotations" => Field::Key_audit_annotations, + "failurePolicy" => Field::Key_failure_policy, + "matchConditions" => Field::Key_match_conditions, + "matchConstraints" => Field::Key_match_constraints, + "paramKind" => Field::Key_param_kind, + "validations" => Field::Key_validations, + "variables" => Field::Key_variables, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicySpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicySpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audit_annotations: Option> = None; + let mut value_failure_policy: Option = None; + let mut value_match_conditions: Option> = None; + let mut value_match_constraints: Option = None; + let mut value_param_kind: Option = None; + let mut value_validations: Option> = None; + let mut value_variables: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audit_annotations => value_audit_annotations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_policy => value_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_conditions => value_match_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_constraints => value_match_constraints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_kind => value_param_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validations => value_validations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_variables => value_variables = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicySpec { + audit_annotations: value_audit_annotations, + failure_policy: value_failure_policy, + match_conditions: value_match_conditions, + match_constraints: value_match_constraints, + param_kind: value_param_kind, + validations: value_validations, + variables: value_variables, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicySpec", + &[ + "auditAnnotations", + "failurePolicy", + "matchConditions", + "matchConstraints", + "paramKind", + "validations", + "variables", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicySpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicySpec", + self.audit_annotations.as_ref().map_or(0, |_| 1) + + self.failure_policy.as_ref().map_or(0, |_| 1) + + self.match_conditions.as_ref().map_or(0, |_| 1) + + self.match_constraints.as_ref().map_or(0, |_| 1) + + self.param_kind.as_ref().map_or(0, |_| 1) + + self.validations.as_ref().map_or(0, |_| 1) + + self.variables.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audit_annotations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "auditAnnotations", value)?; + } + if let Some(value) = &self.failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failurePolicy", value)?; + } + if let Some(value) = &self.match_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConditions", value)?; + } + if let Some(value) = &self.match_constraints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConstraints", value)?; + } + if let Some(value) = &self.param_kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramKind", value)?; + } + if let Some(value) = &self.validations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validations", value)?; + } + if let Some(value) = &self.variables { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "variables", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicySpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicySpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "auditAnnotations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "failurePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "matchConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchConstraints".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramKind".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "validations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "variables".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_admission_policy_status.rs b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_status.rs new file mode 100644 index 000000000..8c1c269d0 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_admission_policy_status.rs @@ -0,0 +1,189 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyStatus + +/// ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyStatus { + /// The conditions represent the latest available observations of a policy's current state. + pub conditions: Option>, + + /// The generation observed by the controller. + pub observed_generation: Option, + + /// The results of type checking for each expression. Presence of this field indicates the completion of the type checking. + pub type_checking: Option, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.type_checking, other.type_checking); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_observed_generation, + Key_type_checking, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "observedGeneration" => Field::Key_observed_generation, + "typeChecking" => Field::Key_type_checking, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_observed_generation: Option = None; + let mut value_type_checking: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_checking => value_type_checking = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyStatus { + conditions: value_conditions, + observed_generation: value_observed_generation, + type_checking: value_type_checking, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyStatus", + &[ + "conditions", + "observedGeneration", + "typeChecking", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.type_checking.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.type_checking { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "typeChecking", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyStatus { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingAdmissionPolicyStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The conditions represent the latest available observations of a policy's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The generation observed by the controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "typeChecking".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The results of type checking for each expression. Presence of this field indicates the completion of the type checking.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_webhook.rs b/src/v1_30/api/admissionregistration/v1/validating_webhook.rs new file mode 100644 index 000000000..7d8b7b7da --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_webhook.rs @@ -0,0 +1,440 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingWebhook + +/// ValidatingWebhook describes an admission webhook and the resources and operations it applies to. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingWebhook { + /// AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. + pub admission_review_versions: Vec, + + /// ClientConfig defines how to communicate with the hook. Required + pub client_config: crate::api::admissionregistration::v1::WebhookClientConfig, + + /// FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail. + pub failure_policy: Option, + + /// MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. + /// + /// The exact matching logic is (in order): + /// 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped. + /// 2. If ALL matchConditions evaluate to TRUE, the webhook is called. + /// 3. If any matchCondition evaluates to an error (but none are FALSE): + /// - If failurePolicy=Fail, reject the request + /// - If failurePolicy=Ignore, the error is ignored and the webhook is skipped + pub match_conditions: Option>, + + /// matchPolicy defines how the "rules" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + /// + /// - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. + /// + /// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. + /// + /// Defaults to "Equivalent" + pub match_policy: Option, + + /// The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where "imagepolicy" is the name of the webhook, and kubernetes.io is the name of the organization. Required. + pub name: String, + + /// NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. + /// + /// For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "runlevel", + /// "operator": "NotIn", + /// "values": \[ + /// "0", + /// "1" + /// \] + /// } + /// \] + /// } + /// + /// If instead you want to only run the webhook on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "environment", + /// "operator": "In", + /// "values": \[ + /// "prod", + /// "staging" + /// \] + /// } + /// \] + /// } + /// + /// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors. + /// + /// Default to the empty LabelSelector, which matches everything. + pub namespace_selector: Option, + + /// ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + pub object_selector: Option, + + /// Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. + pub rules: Option>, + + /// SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. + pub side_effects: String, + + /// TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds. + pub timeout_seconds: Option, +} + +impl crate::DeepMerge for ValidatingWebhook { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.admission_review_versions, other.admission_review_versions); + crate::DeepMerge::merge_from(&mut self.client_config, other.client_config); + crate::DeepMerge::merge_from(&mut self.failure_policy, other.failure_policy); + crate::merge_strategies::list::map( + &mut self.match_conditions, + other.match_conditions, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.match_policy, other.match_policy); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.object_selector, other.object_selector); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + crate::DeepMerge::merge_from(&mut self.side_effects, other.side_effects); + crate::DeepMerge::merge_from(&mut self.timeout_seconds, other.timeout_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingWebhook { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_admission_review_versions, + Key_client_config, + Key_failure_policy, + Key_match_conditions, + Key_match_policy, + Key_name, + Key_namespace_selector, + Key_object_selector, + Key_rules, + Key_side_effects, + Key_timeout_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "admissionReviewVersions" => Field::Key_admission_review_versions, + "clientConfig" => Field::Key_client_config, + "failurePolicy" => Field::Key_failure_policy, + "matchConditions" => Field::Key_match_conditions, + "matchPolicy" => Field::Key_match_policy, + "name" => Field::Key_name, + "namespaceSelector" => Field::Key_namespace_selector, + "objectSelector" => Field::Key_object_selector, + "rules" => Field::Key_rules, + "sideEffects" => Field::Key_side_effects, + "timeoutSeconds" => Field::Key_timeout_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingWebhook; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingWebhook") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_admission_review_versions: Option> = None; + let mut value_client_config: Option = None; + let mut value_failure_policy: Option = None; + let mut value_match_conditions: Option> = None; + let mut value_match_policy: Option = None; + let mut value_name: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_object_selector: Option = None; + let mut value_rules: Option> = None; + let mut value_side_effects: Option = None; + let mut value_timeout_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_admission_review_versions => value_admission_review_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_client_config => value_client_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_policy => value_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_conditions => value_match_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_policy => value_match_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object_selector => value_object_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_side_effects => value_side_effects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_timeout_seconds => value_timeout_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingWebhook { + admission_review_versions: value_admission_review_versions.unwrap_or_default(), + client_config: value_client_config.unwrap_or_default(), + failure_policy: value_failure_policy, + match_conditions: value_match_conditions, + match_policy: value_match_policy, + name: value_name.unwrap_or_default(), + namespace_selector: value_namespace_selector, + object_selector: value_object_selector, + rules: value_rules, + side_effects: value_side_effects.unwrap_or_default(), + timeout_seconds: value_timeout_seconds, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingWebhook", + &[ + "admissionReviewVersions", + "clientConfig", + "failurePolicy", + "matchConditions", + "matchPolicy", + "name", + "namespaceSelector", + "objectSelector", + "rules", + "sideEffects", + "timeoutSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingWebhook { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingWebhook", + 4 + + self.failure_policy.as_ref().map_or(0, |_| 1) + + self.match_conditions.as_ref().map_or(0, |_| 1) + + self.match_policy.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.object_selector.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1) + + self.timeout_seconds.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "admissionReviewVersions", &self.admission_review_versions)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clientConfig", &self.client_config)?; + if let Some(value) = &self.failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failurePolicy", value)?; + } + if let Some(value) = &self.match_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConditions", value)?; + } + if let Some(value) = &self.match_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchPolicy", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.object_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "objectSelector", value)?; + } + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sideEffects", &self.side_effects)?; + if let Some(value) = &self.timeout_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeoutSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingWebhook { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingWebhook".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingWebhook describes an admission webhook and the resources and operations it applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "admissionReviewVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "clientConfig".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClientConfig defines how to communicate with the hook. Required".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "failurePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "matchConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Equivalent\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "objectSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "sideEffects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "timeoutSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "admissionReviewVersions".to_owned(), + "clientConfig".to_owned(), + "name".to_owned(), + "sideEffects".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validating_webhook_configuration.rs b/src/v1_30/api/admissionregistration/v1/validating_webhook_configuration.rs new file mode 100644 index 000000000..f188208c4 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validating_webhook_configuration.rs @@ -0,0 +1,231 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration + +/// ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingWebhookConfiguration { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Webhooks is a list of webhooks and the affected resources and operations. + pub webhooks: Option>, +} + +impl crate::Resource for ValidatingWebhookConfiguration { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingWebhookConfiguration"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "validatingwebhookconfigurations"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingWebhookConfiguration { + const LIST_KIND: &'static str = "ValidatingWebhookConfigurationList"; +} + +impl crate::Metadata for ValidatingWebhookConfiguration { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingWebhookConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::map( + &mut self.webhooks, + other.webhooks, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingWebhookConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_webhooks, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "webhooks" => Field::Key_webhooks, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingWebhookConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_webhooks: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_webhooks => value_webhooks = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingWebhookConfiguration { + metadata: value_metadata.unwrap_or_default(), + webhooks: value_webhooks, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "webhooks", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingWebhookConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.webhooks.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.webhooks { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "webhooks", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingWebhookConfiguration { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "webhooks".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Webhooks is a list of webhooks and the affected resources and operations.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/validation.rs b/src/v1_30/api/admissionregistration/v1/validation.rs new file mode 100644 index 000000000..a5c1dc88f --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/validation.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.Validation + +/// Validation specifies the CEL expression which is used to apply the validation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Validation { + /// Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: + /// + /// - 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request(\[ref\](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + /// For example, a variable named 'foo' can be accessed as 'variables.foo'. + /// - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// + /// The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible. + /// + /// Only property names of the form `\[a-zA-Z_.-/\]\[a-zA-Z0-9_.-/\]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + /// "import", "let", "loop", "package", "namespace", "return". + /// Examples: + /// - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ \> 0"} + /// - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop \> 0"} + /// - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d \> 0"} + /// + /// Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. \[1, 2\] == \[2, 1\]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + /// - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + /// non-intersecting elements in `Y` are appended, retaining their partial order. + /// - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + /// are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + /// non-intersecting keys are appended, retaining their partial order. + /// Required. + pub expression: String, + + /// Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is "failed rule: {Rule}". e.g. "must be a URL with the host matching spec.host" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is "failed Expression: {Expression}". + pub message: Option, + + /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: "object.x must be less than max ("+string(params.max)+")" + pub message_expression: Option, + + /// Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge". If not set, StatusReasonInvalid is used in the response to the client. + pub reason: Option, +} + +impl crate::DeepMerge for Validation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.message_expression, other.message_expression); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Validation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_message, + Key_message_expression, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "message" => Field::Key_message, + "messageExpression" => Field::Key_message_expression, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Validation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Validation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_message: Option = None; + let mut value_message_expression: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message_expression => value_message_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Validation { + expression: value_expression.unwrap_or_default(), + message: value_message, + message_expression: value_message_expression, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "Validation", + &[ + "expression", + "message", + "messageExpression", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Validation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Validation", + 1 + + self.message.as_ref().map_or(0, |_| 1) + + self.message_expression.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.message_expression { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "messageExpression", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Validation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.Validation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validation specifies the CEL expression which is used to apply the validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "messageExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/variable.rs b/src/v1_30/api/admissionregistration/v1/variable.rs new file mode 100644 index 000000000..81d0f30c2 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/variable.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.Variable + +/// Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Variable { + /// Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation. + pub expression: String, + + /// Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is "foo", the variable will be available as `variables.foo` + pub name: String, +} + +impl crate::DeepMerge for Variable { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Variable { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Variable; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Variable") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Variable { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Variable", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Variable { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Variable", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Variable { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.Variable".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1/webhook_client_config.rs b/src/v1_30/api/admissionregistration/v1/webhook_client_config.rs new file mode 100644 index 000000000..e0adf4e46 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1/webhook_client_config.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.api.admissionregistration.v1.WebhookClientConfig + +/// WebhookClientConfig contains the information to make a TLS connection with the webhook +#[derive(Clone, Debug, Default, PartialEq)] +pub struct WebhookClientConfig { + /// `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. + pub ca_bundle: Option, + + /// `service` is a reference to the service for this webhook. Either `service` or `url` must be specified. + /// + /// If the webhook is running within the cluster, then you should use `service`. + pub service: Option, + + /// `url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. + /// + /// The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. + /// + /// Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. + /// + /// The scheme must be "https"; the URL must begin with "https://". + /// + /// A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. + /// + /// Attempting to use a user or basic auth e.g. "user:password@" is not allowed. Fragments ("#...") and query parameters ("?...") are not allowed, either. + pub url: Option, +} + +impl crate::DeepMerge for WebhookClientConfig { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ca_bundle, other.ca_bundle); + crate::DeepMerge::merge_from(&mut self.service, other.service); + crate::DeepMerge::merge_from(&mut self.url, other.url); + } +} + +impl<'de> crate::serde::Deserialize<'de> for WebhookClientConfig { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ca_bundle, + Key_service, + Key_url, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "caBundle" => Field::Key_ca_bundle, + "service" => Field::Key_service, + "url" => Field::Key_url, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WebhookClientConfig; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WebhookClientConfig") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ca_bundle: Option = None; + let mut value_service: Option = None; + let mut value_url: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ca_bundle => value_ca_bundle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_url => value_url = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(WebhookClientConfig { + ca_bundle: value_ca_bundle, + service: value_service, + url: value_url, + }) + } + } + + deserializer.deserialize_struct( + "WebhookClientConfig", + &[ + "caBundle", + "service", + "url", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for WebhookClientConfig { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WebhookClientConfig", + self.ca_bundle.as_ref().map_or(0, |_| 1) + + self.service.as_ref().map_or(0, |_| 1) + + self.url.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ca_bundle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "caBundle", value)?; + } + if let Some(value) = &self.service { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?; + } + if let Some(value) = &self.url { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "url", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WebhookClientConfig { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1.WebhookClientConfig".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WebhookClientConfig contains the information to make a TLS connection with the webhook".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "caBundle".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }), + ), + ( + "service".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "url".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/audit_annotation.rs b/src/v1_30/api/admissionregistration/v1alpha1/audit_annotation.rs new file mode 100644 index 000000000..79c73b494 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/audit_annotation.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.AuditAnnotation + +/// AuditAnnotation describes how to produce an audit annotation for an API request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AuditAnnotation { + /// key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name (\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*) no more than 63 bytes in length. + /// + /// The key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: "{ValidatingAdmissionPolicy name}/{key}". + /// + /// If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded. + /// + /// Required. + pub key: String, + + /// valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb. + /// + /// If multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list. + /// + /// Required. + pub value_expression: String, +} + +impl crate::DeepMerge for AuditAnnotation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.value_expression, other.value_expression); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AuditAnnotation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_value_expression, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "valueExpression" => Field::Key_value_expression, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AuditAnnotation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AuditAnnotation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_value_expression: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value_expression => value_value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AuditAnnotation { + key: value_key.unwrap_or_default(), + value_expression: value_value_expression.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AuditAnnotation", + &[ + "key", + "valueExpression", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AuditAnnotation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AuditAnnotation", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "valueExpression", &self.value_expression)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AuditAnnotation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.AuditAnnotation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AuditAnnotation describes how to produce an audit annotation for an API request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.\n\nThe key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: \"{ValidatingAdmissionPolicy name}/{key}\".\n\nIf an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "valueExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb.\n\nIf multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "valueExpression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/expression_warning.rs b/src/v1_30/api/admissionregistration/v1alpha1/expression_warning.rs new file mode 100644 index 000000000..ad6b4a403 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/expression_warning.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ExpressionWarning + +/// ExpressionWarning is a warning information that targets a specific expression. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExpressionWarning { + /// The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is "spec.validations\[0\].expression" + pub field_ref: String, + + /// The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler. + pub warning: String, +} + +impl crate::DeepMerge for ExpressionWarning { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field_ref, other.field_ref); + crate::DeepMerge::merge_from(&mut self.warning, other.warning); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExpressionWarning { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field_ref, + Key_warning, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fieldRef" => Field::Key_field_ref, + "warning" => Field::Key_warning, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExpressionWarning; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExpressionWarning") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field_ref: Option = None; + let mut value_warning: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field_ref => value_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_warning => value_warning = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExpressionWarning { + field_ref: value_field_ref.unwrap_or_default(), + warning: value_warning.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ExpressionWarning", + &[ + "fieldRef", + "warning", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExpressionWarning { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExpressionWarning", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldRef", &self.field_ref)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "warning", &self.warning)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExpressionWarning { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ExpressionWarning".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExpressionWarning is a warning information that targets a specific expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fieldRef".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "warning".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "fieldRef".to_owned(), + "warning".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/match_condition.rs b/src/v1_30/api/admissionregistration/v1alpha1/match_condition.rs new file mode 100644 index 000000000..802a8628b --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/match_condition.rs @@ -0,0 +1,156 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.MatchCondition + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchCondition { + /// Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: + /// + /// 'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/ + /// + /// Required. + pub expression: String, + + /// Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '(\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*)?\[A-Za-z0-9\]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName') + /// + /// Required. + pub name: String, +} + +impl crate::DeepMerge for MatchCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchCondition { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MatchCondition", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchCondition", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchCondition { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.MatchCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/match_resources.rs b/src/v1_30/api/admissionregistration/v1alpha1/match_resources.rs new file mode 100644 index 000000000..7080d3ca4 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/match_resources.rs @@ -0,0 +1,271 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.MatchResources + +/// MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchResources { + /// ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) + pub exclude_resource_rules: Option>, + + /// matchPolicy defines how the "MatchResources" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + /// + /// - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy. + /// + /// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy. + /// + /// Defaults to "Equivalent" + pub match_policy: Option, + + /// NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy. + /// + /// For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "runlevel", + /// "operator": "NotIn", + /// "values": \[ + /// "0", + /// "1" + /// \] + /// } + /// \] + /// } + /// + /// If instead you want to only run the policy on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "environment", + /// "operator": "In", + /// "values": \[ + /// "prod", + /// "staging" + /// \] + /// } + /// \] + /// } + /// + /// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. + /// + /// Default to the empty LabelSelector, which matches everything. + pub namespace_selector: Option, + + /// ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + pub object_selector: Option, + + /// ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule. + pub resource_rules: Option>, +} + +impl crate::DeepMerge for MatchResources { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.exclude_resource_rules, other.exclude_resource_rules); + crate::DeepMerge::merge_from(&mut self.match_policy, other.match_policy); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.object_selector, other.object_selector); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchResources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exclude_resource_rules, + Key_match_policy, + Key_namespace_selector, + Key_object_selector, + Key_resource_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "excludeResourceRules" => Field::Key_exclude_resource_rules, + "matchPolicy" => Field::Key_match_policy, + "namespaceSelector" => Field::Key_namespace_selector, + "objectSelector" => Field::Key_object_selector, + "resourceRules" => Field::Key_resource_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchResources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchResources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exclude_resource_rules: Option> = None; + let mut value_match_policy: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_object_selector: Option = None; + let mut value_resource_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exclude_resource_rules => value_exclude_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_policy => value_match_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object_selector => value_object_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchResources { + exclude_resource_rules: value_exclude_resource_rules, + match_policy: value_match_policy, + namespace_selector: value_namespace_selector, + object_selector: value_object_selector, + resource_rules: value_resource_rules, + }) + } + } + + deserializer.deserialize_struct( + "MatchResources", + &[ + "excludeResourceRules", + "matchPolicy", + "namespaceSelector", + "objectSelector", + "resourceRules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchResources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchResources", + self.exclude_resource_rules.as_ref().map_or(0, |_| 1) + + self.match_policy.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.object_selector.as_ref().map_or(0, |_| 1) + + self.resource_rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exclude_resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "excludeResourceRules", value)?; + } + if let Some(value) = &self.match_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchPolicy", value)?; + } + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.object_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "objectSelector", value)?; + } + if let Some(value) = &self.resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchResources { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.MatchResources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "excludeResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.\n\nDefaults to \"Equivalent\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "objectSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/mod.rs b/src/v1_30/api/admissionregistration/v1alpha1/mod.rs new file mode 100644 index 000000000..bd737da49 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/mod.rs @@ -0,0 +1,45 @@ + +mod audit_annotation; +pub use self::audit_annotation::AuditAnnotation; + +mod expression_warning; +pub use self::expression_warning::ExpressionWarning; + +mod match_condition; +pub use self::match_condition::MatchCondition; + +mod match_resources; +pub use self::match_resources::MatchResources; + +mod named_rule_with_operations; +pub use self::named_rule_with_operations::NamedRuleWithOperations; + +mod param_kind; +pub use self::param_kind::ParamKind; + +mod param_ref; +pub use self::param_ref::ParamRef; + +mod type_checking; +pub use self::type_checking::TypeChecking; + +mod validating_admission_policy; +pub use self::validating_admission_policy::ValidatingAdmissionPolicy; + +mod validating_admission_policy_binding; +pub use self::validating_admission_policy_binding::ValidatingAdmissionPolicyBinding; + +mod validating_admission_policy_binding_spec; +pub use self::validating_admission_policy_binding_spec::ValidatingAdmissionPolicyBindingSpec; + +mod validating_admission_policy_spec; +pub use self::validating_admission_policy_spec::ValidatingAdmissionPolicySpec; + +mod validating_admission_policy_status; +pub use self::validating_admission_policy_status::ValidatingAdmissionPolicyStatus; + +mod validation; +pub use self::validation::Validation; + +mod variable; +pub use self::variable::Variable; diff --git a/src/v1_30/api/admissionregistration/v1alpha1/named_rule_with_operations.rs b/src/v1_30/api/admissionregistration/v1alpha1/named_rule_with_operations.rs new file mode 100644 index 000000000..9c1ff2b2a --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/named_rule_with_operations.rs @@ -0,0 +1,303 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.NamedRuleWithOperations + +/// NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedRuleWithOperations { + /// APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required. + pub api_groups: Option>, + + /// APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required. + pub api_versions: Option>, + + /// Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. + pub operations: Option>, + + /// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + pub resource_names: Option>, + + /// Resources is a list of resources this rule applies to. + /// + /// For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources. + /// + /// If wildcard is present, the validation rule will ensure resources do not overlap with each other. + /// + /// Depending on the enclosing object, subresources might not be allowed. Required. + pub resources: Option>, + + /// scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "*" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "*" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". + pub scope: Option, +} + +impl crate::DeepMerge for NamedRuleWithOperations { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.api_versions, other.api_versions); + crate::merge_strategies::list::atomic(&mut self.operations, other.operations); + crate::merge_strategies::list::atomic(&mut self.resource_names, other.resource_names); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedRuleWithOperations { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_api_versions, + Key_operations, + Key_resource_names, + Key_resources, + Key_scope, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "apiVersions" => Field::Key_api_versions, + "operations" => Field::Key_operations, + "resourceNames" => Field::Key_resource_names, + "resources" => Field::Key_resources, + "scope" => Field::Key_scope, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedRuleWithOperations; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedRuleWithOperations") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_api_versions: Option> = None; + let mut value_operations: Option> = None; + let mut value_resource_names: Option> = None; + let mut value_resources: Option> = None; + let mut value_scope: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_api_versions => value_api_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operations => value_operations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_names => value_resource_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedRuleWithOperations { + api_groups: value_api_groups, + api_versions: value_api_versions, + operations: value_operations, + resource_names: value_resource_names, + resources: value_resources, + scope: value_scope, + }) + } + } + + deserializer.deserialize_struct( + "NamedRuleWithOperations", + &[ + "apiGroups", + "apiVersions", + "operations", + "resourceNames", + "resources", + "scope", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedRuleWithOperations { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedRuleWithOperations", + self.api_groups.as_ref().map_or(0, |_| 1) + + self.api_versions.as_ref().map_or(0, |_| 1) + + self.operations.as_ref().map_or(0, |_| 1) + + self.resource_names.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.scope.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.api_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersions", value)?; + } + if let Some(value) = &self.operations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operations", value)?; + } + if let Some(value) = &self.resource_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceNames", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedRuleWithOperations { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.NamedRuleWithOperations".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "apiVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "operations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope specifies the scope of this rule. Valid values are \"Cluster\", \"Namespaced\", and \"*\" \"Cluster\" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. \"Namespaced\" means that only namespaced resources will match this rule. \"*\" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is \"*\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/param_kind.rs b/src/v1_30/api/admissionregistration/v1alpha1/param_kind.rs new file mode 100644 index 000000000..b762f10b4 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/param_kind.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ParamKind + +/// ParamKind is a tuple of Group Kind and Version. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamKind { + /// APIVersion is the API group version the resources belong to. In format of "group/version". Required. + pub api_version: Option, + + /// Kind is the API kind the resources belong to. Required. + pub kind: Option, +} + +impl crate::DeepMerge for ParamKind { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamKind { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamKind; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamKind") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamKind { + api_version: value_api_version, + kind: value_kind, + }) + } + } + + deserializer.deserialize_struct( + "ParamKind", + &[ + "apiVersion", + "kind", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamKind { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamKind", + self.api_version.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamKind { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ParamKind".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind is a tuple of Group Kind and Version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the API kind the resources belong to. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/param_ref.rs b/src/v1_30/api/admissionregistration/v1alpha1/param_ref.rs new file mode 100644 index 000000000..7f27cf23b --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/param_ref.rs @@ -0,0 +1,216 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ParamRef + +/// ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamRef { + /// `name` is the name of the resource being referenced. + /// + /// `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + pub name: Option, + + /// namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields. + /// + /// A per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty. + /// + /// - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error. + /// + /// - If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error. + pub namespace: Option, + + /// `parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy. + /// + /// Allowed values are `Allow` or `Deny` Default to `Deny` + pub parameter_not_found_action: Option, + + /// selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind. + /// + /// If multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together. + /// + /// One of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + pub selector: Option, +} + +impl crate::DeepMerge for ParamRef { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.parameter_not_found_action, other.parameter_not_found_action); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamRef { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_parameter_not_found_action, + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "parameterNotFoundAction" => Field::Key_parameter_not_found_action, + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamRef; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamRef") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_parameter_not_found_action: Option = None; + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameter_not_found_action => value_parameter_not_found_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamRef { + name: value_name, + namespace: value_namespace, + parameter_not_found_action: value_parameter_not_found_action, + selector: value_selector, + }) + } + } + + deserializer.deserialize_struct( + "ParamRef", + &[ + "name", + "namespace", + "parameterNotFoundAction", + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamRef { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamRef", + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.parameter_not_found_action.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.parameter_not_found_action { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameterNotFoundAction", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamRef { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ParamRef".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of the resource being referenced.\n\n`name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parameterNotFoundAction".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny` Default to `Deny`".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/type_checking.rs b/src/v1_30/api/admissionregistration/v1alpha1/type_checking.rs new file mode 100644 index 000000000..b00abfafb --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/type_checking.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.TypeChecking + +/// TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TypeChecking { + /// The type checking warnings for each expression. + pub expression_warnings: Option>, +} + +impl crate::DeepMerge for TypeChecking { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.expression_warnings, other.expression_warnings); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TypeChecking { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression_warnings, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expressionWarnings" => Field::Key_expression_warnings, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TypeChecking; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TypeChecking") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression_warnings: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression_warnings => value_expression_warnings = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TypeChecking { + expression_warnings: value_expression_warnings, + }) + } + } + + deserializer.deserialize_struct( + "TypeChecking", + &[ + "expressionWarnings", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TypeChecking { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TypeChecking", + self.expression_warnings.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.expression_warnings { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expressionWarnings", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TypeChecking { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.TypeChecking".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expressionWarnings".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The type checking warnings for each expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy.rs b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy.rs new file mode 100644 index 000000000..3dbce5aba --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicy + +/// ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicy { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicy. + pub spec: Option, + + /// The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only. + pub status: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicy { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicy"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicies"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicy { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicy { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicy { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicy { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicy.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs new file mode 100644 index 000000000..6c29b1b86 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding.rs @@ -0,0 +1,224 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyBinding + +/// ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters. +/// +/// For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. +/// +/// The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBinding { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + pub spec: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicyBinding { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1alpha1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicyBinding"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicybindings"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicyBinding { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyBindingList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicyBinding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBinding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBinding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBinding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBinding { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBinding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBinding { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyBinding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding_spec.rs b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding_spec.rs new file mode 100644 index 000000000..15b03718f --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_binding_spec.rs @@ -0,0 +1,229 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyBindingSpec + +/// ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBindingSpec { + /// MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required. + pub match_resources: Option, + + /// paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + pub param_ref: Option, + + /// PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required. + pub policy_name: Option, + + /// validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions. + /// + /// Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy. + /// + /// validationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action. + /// + /// The supported actions values are: + /// + /// "Deny" specifies that a validation failure results in a denied request. + /// + /// "Warn" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses. + /// + /// "Audit" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `"validation.policy.admission.k8s.io/validation_failure": "\[{"message": "Invalid value", {"policy": "policy.example.com", {"binding": "policybinding.example.com", {"expressionIndex": "1", {"validationActions": \["Audit"\]}\]"` + /// + /// Clients should expect to handle additional values by ignoring any values not recognized. + /// + /// "Deny" and "Warn" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers. + /// + /// Required. + pub validation_actions: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBindingSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.match_resources, other.match_resources); + crate::DeepMerge::merge_from(&mut self.param_ref, other.param_ref); + crate::DeepMerge::merge_from(&mut self.policy_name, other.policy_name); + crate::merge_strategies::list::set(&mut self.validation_actions, other.validation_actions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBindingSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_resources, + Key_param_ref, + Key_policy_name, + Key_validation_actions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchResources" => Field::Key_match_resources, + "paramRef" => Field::Key_param_ref, + "policyName" => Field::Key_policy_name, + "validationActions" => Field::Key_validation_actions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBindingSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyBindingSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_resources: Option = None; + let mut value_param_ref: Option = None; + let mut value_policy_name: Option = None; + let mut value_validation_actions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_resources => value_match_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_ref => value_param_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_policy_name => value_policy_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validation_actions => value_validation_actions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBindingSpec { + match_resources: value_match_resources, + param_ref: value_param_ref, + policy_name: value_policy_name, + validation_actions: value_validation_actions, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + &[ + "matchResources", + "paramRef", + "policyName", + "validationActions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBindingSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + self.match_resources.as_ref().map_or(0, |_| 1) + + self.param_ref.as_ref().map_or(0, |_| 1) + + self.policy_name.as_ref().map_or(0, |_| 1) + + self.validation_actions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchResources", value)?; + } + if let Some(value) = &self.param_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramRef", value)?; + } + if let Some(value) = &self.policy_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "policyName", value)?; + } + if let Some(value) = &self.validation_actions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validationActions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBindingSpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyBindingSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "policyName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "validationActions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_spec.rs b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_spec.rs new file mode 100644 index 000000000..a910222c3 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_spec.rs @@ -0,0 +1,326 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicySpec + +/// ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicySpec { + /// auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required. + pub audit_annotations: Option>, + + /// failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings. + /// + /// A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource. + /// + /// failurePolicy does not define how validations that evaluate to false are handled. + /// + /// When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced. + /// + /// Allowed values are Ignore or Fail. Defaults to Fail. + pub failure_policy: Option, + + /// MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. + /// + /// If a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions. + /// + /// The exact matching logic is (in order): + /// 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + /// 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + /// 3. If any matchCondition evaluates to an error (but none are FALSE): + /// - If failurePolicy=Fail, reject the request + /// - If failurePolicy=Ignore, the policy is skipped + pub match_conditions: Option>, + + /// MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required. + pub match_constraints: Option, + + /// ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. + pub param_kind: Option, + + /// Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required. + pub validations: Option>, + + /// Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy. + /// + /// The expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic. + pub variables: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicySpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audit_annotations, other.audit_annotations); + crate::DeepMerge::merge_from(&mut self.failure_policy, other.failure_policy); + crate::merge_strategies::list::map( + &mut self.match_conditions, + other.match_conditions, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.match_constraints, other.match_constraints); + crate::DeepMerge::merge_from(&mut self.param_kind, other.param_kind); + crate::merge_strategies::list::atomic(&mut self.validations, other.validations); + crate::merge_strategies::list::map( + &mut self.variables, + other.variables, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicySpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audit_annotations, + Key_failure_policy, + Key_match_conditions, + Key_match_constraints, + Key_param_kind, + Key_validations, + Key_variables, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "auditAnnotations" => Field::Key_audit_annotations, + "failurePolicy" => Field::Key_failure_policy, + "matchConditions" => Field::Key_match_conditions, + "matchConstraints" => Field::Key_match_constraints, + "paramKind" => Field::Key_param_kind, + "validations" => Field::Key_validations, + "variables" => Field::Key_variables, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicySpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicySpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audit_annotations: Option> = None; + let mut value_failure_policy: Option = None; + let mut value_match_conditions: Option> = None; + let mut value_match_constraints: Option = None; + let mut value_param_kind: Option = None; + let mut value_validations: Option> = None; + let mut value_variables: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audit_annotations => value_audit_annotations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_policy => value_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_conditions => value_match_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_constraints => value_match_constraints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_kind => value_param_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validations => value_validations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_variables => value_variables = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicySpec { + audit_annotations: value_audit_annotations, + failure_policy: value_failure_policy, + match_conditions: value_match_conditions, + match_constraints: value_match_constraints, + param_kind: value_param_kind, + validations: value_validations, + variables: value_variables, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicySpec", + &[ + "auditAnnotations", + "failurePolicy", + "matchConditions", + "matchConstraints", + "paramKind", + "validations", + "variables", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicySpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicySpec", + self.audit_annotations.as_ref().map_or(0, |_| 1) + + self.failure_policy.as_ref().map_or(0, |_| 1) + + self.match_conditions.as_ref().map_or(0, |_| 1) + + self.match_constraints.as_ref().map_or(0, |_| 1) + + self.param_kind.as_ref().map_or(0, |_| 1) + + self.validations.as_ref().map_or(0, |_| 1) + + self.variables.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audit_annotations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "auditAnnotations", value)?; + } + if let Some(value) = &self.failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failurePolicy", value)?; + } + if let Some(value) = &self.match_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConditions", value)?; + } + if let Some(value) = &self.match_constraints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConstraints", value)?; + } + if let Some(value) = &self.param_kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramKind", value)?; + } + if let Some(value) = &self.validations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validations", value)?; + } + if let Some(value) = &self.variables { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "variables", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicySpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicySpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "auditAnnotations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "failurePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "matchConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchConstraints".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramKind".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "validations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "variables".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_status.rs b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_status.rs new file mode 100644 index 000000000..5555e4533 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validating_admission_policy_status.rs @@ -0,0 +1,189 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyStatus + +/// ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyStatus { + /// The conditions represent the latest available observations of a policy's current state. + pub conditions: Option>, + + /// The generation observed by the controller. + pub observed_generation: Option, + + /// The results of type checking for each expression. Presence of this field indicates the completion of the type checking. + pub type_checking: Option, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.type_checking, other.type_checking); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_observed_generation, + Key_type_checking, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "observedGeneration" => Field::Key_observed_generation, + "typeChecking" => Field::Key_type_checking, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_observed_generation: Option = None; + let mut value_type_checking: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_checking => value_type_checking = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyStatus { + conditions: value_conditions, + observed_generation: value_observed_generation, + type_checking: value_type_checking, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyStatus", + &[ + "conditions", + "observedGeneration", + "typeChecking", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.type_checking.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.type_checking { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "typeChecking", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyStatus { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.ValidatingAdmissionPolicyStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The conditions represent the latest available observations of a policy's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The generation observed by the controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "typeChecking".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The results of type checking for each expression. Presence of this field indicates the completion of the type checking.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/validation.rs b/src/v1_30/api/admissionregistration/v1alpha1/validation.rs new file mode 100644 index 000000000..681237469 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/validation.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.Validation + +/// Validation specifies the CEL expression which is used to apply the validation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Validation { + /// Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: + /// + /// - 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request(\[ref\](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + /// For example, a variable named 'foo' can be accessed as 'variables.foo'. + /// - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// + /// The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible. + /// + /// Only property names of the form `\[a-zA-Z_.-/\]\[a-zA-Z0-9_.-/\]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + /// "import", "let", "loop", "package", "namespace", "return". + /// Examples: + /// - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ \> 0"} + /// - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop \> 0"} + /// - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d \> 0"} + /// + /// Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. \[1, 2\] == \[2, 1\]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + /// - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + /// non-intersecting elements in `Y` are appended, retaining their partial order. + /// - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + /// are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + /// non-intersecting keys are appended, retaining their partial order. + /// Required. + pub expression: String, + + /// Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is "failed rule: {Rule}". e.g. "must be a URL with the host matching spec.host" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is "failed Expression: {Expression}". + pub message: Option, + + /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: "object.x must be less than max ("+string(params.max)+")" + pub message_expression: Option, + + /// Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge". If not set, StatusReasonInvalid is used in the response to the client. + pub reason: Option, +} + +impl crate::DeepMerge for Validation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.message_expression, other.message_expression); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Validation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_message, + Key_message_expression, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "message" => Field::Key_message, + "messageExpression" => Field::Key_message_expression, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Validation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Validation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_message: Option = None; + let mut value_message_expression: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message_expression => value_message_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Validation { + expression: value_expression.unwrap_or_default(), + message: value_message, + message_expression: value_message_expression, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "Validation", + &[ + "expression", + "message", + "messageExpression", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Validation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Validation", + 1 + + self.message.as_ref().map_or(0, |_| 1) + + self.message_expression.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.message_expression { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "messageExpression", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Validation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.Validation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validation specifies the CEL expression which is used to apply the validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "messageExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1alpha1/variable.rs b/src/v1_30/api/admissionregistration/v1alpha1/variable.rs new file mode 100644 index 000000000..16797fed0 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1alpha1/variable.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1alpha1.Variable + +/// Variable is the definition of a variable that is used for composition. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Variable { + /// Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation. + pub expression: String, + + /// Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is "foo", the variable will be available as `variables.foo` + pub name: String, +} + +impl crate::DeepMerge for Variable { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Variable { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Variable; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Variable") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Variable { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Variable", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Variable { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Variable", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Variable { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1alpha1.Variable".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variable is the definition of a variable that is used for composition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/audit_annotation.rs b/src/v1_30/api/admissionregistration/v1beta1/audit_annotation.rs new file mode 100644 index 000000000..4eb00e787 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/audit_annotation.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.AuditAnnotation + +/// AuditAnnotation describes how to produce an audit annotation for an API request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AuditAnnotation { + /// key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name (\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*) no more than 63 bytes in length. + /// + /// The key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: "{ValidatingAdmissionPolicy name}/{key}". + /// + /// If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded. + /// + /// Required. + pub key: String, + + /// valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb. + /// + /// If multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list. + /// + /// Required. + pub value_expression: String, +} + +impl crate::DeepMerge for AuditAnnotation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.value_expression, other.value_expression); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AuditAnnotation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_value_expression, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "valueExpression" => Field::Key_value_expression, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AuditAnnotation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AuditAnnotation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_value_expression: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value_expression => value_value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AuditAnnotation { + key: value_key.unwrap_or_default(), + value_expression: value_value_expression.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AuditAnnotation", + &[ + "key", + "valueExpression", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AuditAnnotation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AuditAnnotation", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "valueExpression", &self.value_expression)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AuditAnnotation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.AuditAnnotation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AuditAnnotation describes how to produce an audit annotation for an API request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.\n\nThe key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: \"{ValidatingAdmissionPolicy name}/{key}\".\n\nIf an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "valueExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("valueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb.\n\nIf multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "valueExpression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/expression_warning.rs b/src/v1_30/api/admissionregistration/v1beta1/expression_warning.rs new file mode 100644 index 000000000..b931726a0 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/expression_warning.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ExpressionWarning + +/// ExpressionWarning is a warning information that targets a specific expression. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExpressionWarning { + /// The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is "spec.validations\[0\].expression" + pub field_ref: String, + + /// The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler. + pub warning: String, +} + +impl crate::DeepMerge for ExpressionWarning { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field_ref, other.field_ref); + crate::DeepMerge::merge_from(&mut self.warning, other.warning); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExpressionWarning { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field_ref, + Key_warning, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fieldRef" => Field::Key_field_ref, + "warning" => Field::Key_warning, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExpressionWarning; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExpressionWarning") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field_ref: Option = None; + let mut value_warning: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field_ref => value_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_warning => value_warning = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExpressionWarning { + field_ref: value_field_ref.unwrap_or_default(), + warning: value_warning.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ExpressionWarning", + &[ + "fieldRef", + "warning", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExpressionWarning { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExpressionWarning", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldRef", &self.field_ref)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "warning", &self.warning)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExpressionWarning { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ExpressionWarning".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExpressionWarning is a warning information that targets a specific expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fieldRef".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "warning".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "fieldRef".to_owned(), + "warning".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/match_condition.rs b/src/v1_30/api/admissionregistration/v1beta1/match_condition.rs new file mode 100644 index 000000000..b4d661100 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/match_condition.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.MatchCondition + +/// MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchCondition { + /// Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: + /// + /// 'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/ + /// + /// Required. + pub expression: String, + + /// Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '(\[A-Za-z0-9\]\[-A-Za-z0-9_.\]*)?\[A-Za-z0-9\]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName') + /// + /// Required. + pub name: String, +} + +impl crate::DeepMerge for MatchCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchCondition { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MatchCondition", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchCondition", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchCondition { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.MatchCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/match_resources.rs b/src/v1_30/api/admissionregistration/v1beta1/match_resources.rs new file mode 100644 index 000000000..04065f1b6 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/match_resources.rs @@ -0,0 +1,271 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.MatchResources + +/// MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MatchResources { + /// ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded) + pub exclude_resource_rules: Option>, + + /// matchPolicy defines how the "MatchResources" list is used to match incoming requests. Allowed values are "Exact" or "Equivalent". + /// + /// - Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy. + /// + /// - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and "rules" only included `apiGroups:\["apps"\], apiVersions:\["v1"\], resources: \["deployments"\]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy. + /// + /// Defaults to "Equivalent" + pub match_policy: Option, + + /// NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy. + /// + /// For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "runlevel", + /// "operator": "NotIn", + /// "values": \[ + /// "0", + /// "1" + /// \] + /// } + /// \] + /// } + /// + /// If instead you want to only run the policy on any objects whose namespace is associated with the "environment" of "prod" or "staging"; you will set the selector as follows: "namespaceSelector": { + /// "matchExpressions": \[ + /// { + /// "key": "environment", + /// "operator": "In", + /// "values": \[ + /// "prod", + /// "staging" + /// \] + /// } + /// \] + /// } + /// + /// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. + /// + /// Default to the empty LabelSelector, which matches everything. + pub namespace_selector: Option, + + /// ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything. + pub object_selector: Option, + + /// ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule. + pub resource_rules: Option>, +} + +impl crate::DeepMerge for MatchResources { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.exclude_resource_rules, other.exclude_resource_rules); + crate::DeepMerge::merge_from(&mut self.match_policy, other.match_policy); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.object_selector, other.object_selector); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MatchResources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exclude_resource_rules, + Key_match_policy, + Key_namespace_selector, + Key_object_selector, + Key_resource_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "excludeResourceRules" => Field::Key_exclude_resource_rules, + "matchPolicy" => Field::Key_match_policy, + "namespaceSelector" => Field::Key_namespace_selector, + "objectSelector" => Field::Key_object_selector, + "resourceRules" => Field::Key_resource_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MatchResources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MatchResources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exclude_resource_rules: Option> = None; + let mut value_match_policy: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_object_selector: Option = None; + let mut value_resource_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exclude_resource_rules => value_exclude_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_policy => value_match_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object_selector => value_object_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MatchResources { + exclude_resource_rules: value_exclude_resource_rules, + match_policy: value_match_policy, + namespace_selector: value_namespace_selector, + object_selector: value_object_selector, + resource_rules: value_resource_rules, + }) + } + } + + deserializer.deserialize_struct( + "MatchResources", + &[ + "excludeResourceRules", + "matchPolicy", + "namespaceSelector", + "objectSelector", + "resourceRules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MatchResources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MatchResources", + self.exclude_resource_rules.as_ref().map_or(0, |_| 1) + + self.match_policy.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.object_selector.as_ref().map_or(0, |_| 1) + + self.resource_rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exclude_resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "excludeResourceRules", value)?; + } + if let Some(value) = &self.match_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchPolicy", value)?; + } + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.object_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "objectSelector", value)?; + } + if let Some(value) = &self.resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MatchResources { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.MatchResources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "excludeResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.\n\nDefaults to \"Equivalent\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "objectSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/mod.rs b/src/v1_30/api/admissionregistration/v1beta1/mod.rs new file mode 100644 index 000000000..bd737da49 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/mod.rs @@ -0,0 +1,45 @@ + +mod audit_annotation; +pub use self::audit_annotation::AuditAnnotation; + +mod expression_warning; +pub use self::expression_warning::ExpressionWarning; + +mod match_condition; +pub use self::match_condition::MatchCondition; + +mod match_resources; +pub use self::match_resources::MatchResources; + +mod named_rule_with_operations; +pub use self::named_rule_with_operations::NamedRuleWithOperations; + +mod param_kind; +pub use self::param_kind::ParamKind; + +mod param_ref; +pub use self::param_ref::ParamRef; + +mod type_checking; +pub use self::type_checking::TypeChecking; + +mod validating_admission_policy; +pub use self::validating_admission_policy::ValidatingAdmissionPolicy; + +mod validating_admission_policy_binding; +pub use self::validating_admission_policy_binding::ValidatingAdmissionPolicyBinding; + +mod validating_admission_policy_binding_spec; +pub use self::validating_admission_policy_binding_spec::ValidatingAdmissionPolicyBindingSpec; + +mod validating_admission_policy_spec; +pub use self::validating_admission_policy_spec::ValidatingAdmissionPolicySpec; + +mod validating_admission_policy_status; +pub use self::validating_admission_policy_status::ValidatingAdmissionPolicyStatus; + +mod validation; +pub use self::validation::Validation; + +mod variable; +pub use self::variable::Variable; diff --git a/src/v1_30/api/admissionregistration/v1beta1/named_rule_with_operations.rs b/src/v1_30/api/admissionregistration/v1beta1/named_rule_with_operations.rs new file mode 100644 index 000000000..f843eb1e6 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/named_rule_with_operations.rs @@ -0,0 +1,303 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.NamedRuleWithOperations + +/// NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedRuleWithOperations { + /// APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required. + pub api_groups: Option>, + + /// APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required. + pub api_versions: Option>, + + /// Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required. + pub operations: Option>, + + /// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + pub resource_names: Option>, + + /// Resources is a list of resources this rule applies to. + /// + /// For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources. + /// + /// If wildcard is present, the validation rule will ensure resources do not overlap with each other. + /// + /// Depending on the enclosing object, subresources might not be allowed. Required. + pub resources: Option>, + + /// scope specifies the scope of this rule. Valid values are "Cluster", "Namespaced", and "*" "Cluster" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. "Namespaced" means that only namespaced resources will match this rule. "*" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is "*". + pub scope: Option, +} + +impl crate::DeepMerge for NamedRuleWithOperations { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.api_versions, other.api_versions); + crate::merge_strategies::list::atomic(&mut self.operations, other.operations); + crate::merge_strategies::list::atomic(&mut self.resource_names, other.resource_names); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedRuleWithOperations { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_api_versions, + Key_operations, + Key_resource_names, + Key_resources, + Key_scope, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "apiVersions" => Field::Key_api_versions, + "operations" => Field::Key_operations, + "resourceNames" => Field::Key_resource_names, + "resources" => Field::Key_resources, + "scope" => Field::Key_scope, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedRuleWithOperations; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedRuleWithOperations") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_api_versions: Option> = None; + let mut value_operations: Option> = None; + let mut value_resource_names: Option> = None; + let mut value_resources: Option> = None; + let mut value_scope: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_api_versions => value_api_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operations => value_operations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_names => value_resource_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedRuleWithOperations { + api_groups: value_api_groups, + api_versions: value_api_versions, + operations: value_operations, + resource_names: value_resource_names, + resources: value_resources, + scope: value_scope, + }) + } + } + + deserializer.deserialize_struct( + "NamedRuleWithOperations", + &[ + "apiGroups", + "apiVersions", + "operations", + "resourceNames", + "resources", + "scope", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedRuleWithOperations { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedRuleWithOperations", + self.api_groups.as_ref().map_or(0, |_| 1) + + self.api_versions.as_ref().map_or(0, |_| 1) + + self.operations.as_ref().map_or(0, |_| 1) + + self.resource_names.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.scope.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.api_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersions", value)?; + } + if let Some(value) = &self.operations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operations", value)?; + } + if let Some(value) = &self.resource_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceNames", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedRuleWithOperations { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.NamedRuleWithOperations".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "apiVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "operations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope specifies the scope of this rule. Valid values are \"Cluster\", \"Namespaced\", and \"*\" \"Cluster\" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. \"Namespaced\" means that only namespaced resources will match this rule. \"*\" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is \"*\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/param_kind.rs b/src/v1_30/api/admissionregistration/v1beta1/param_kind.rs new file mode 100644 index 000000000..599494910 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/param_kind.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ParamKind + +/// ParamKind is a tuple of Group Kind and Version. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamKind { + /// APIVersion is the API group version the resources belong to. In format of "group/version". Required. + pub api_version: Option, + + /// Kind is the API kind the resources belong to. Required. + pub kind: Option, +} + +impl crate::DeepMerge for ParamKind { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamKind { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamKind; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamKind") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamKind { + api_version: value_api_version, + kind: value_kind, + }) + } + } + + deserializer.deserialize_struct( + "ParamKind", + &[ + "apiVersion", + "kind", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamKind { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamKind", + self.api_version.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamKind { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ParamKind".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind is a tuple of Group Kind and Version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the API kind the resources belong to. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/param_ref.rs b/src/v1_30/api/admissionregistration/v1beta1/param_ref.rs new file mode 100644 index 000000000..e9c17093a --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/param_ref.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ParamRef + +/// ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParamRef { + /// name is the name of the resource being referenced. + /// + /// One of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + /// + /// A single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped. + pub name: Option, + + /// namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields. + /// + /// A per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty. + /// + /// - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error. + /// + /// - If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error. + pub namespace: Option, + + /// `parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy. + /// + /// Allowed values are `Allow` or `Deny` + /// + /// Required + pub parameter_not_found_action: Option, + + /// selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind. + /// + /// If multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together. + /// + /// One of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset. + pub selector: Option, +} + +impl crate::DeepMerge for ParamRef { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.parameter_not_found_action, other.parameter_not_found_action); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParamRef { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_parameter_not_found_action, + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "parameterNotFoundAction" => Field::Key_parameter_not_found_action, + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParamRef; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParamRef") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_parameter_not_found_action: Option = None; + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameter_not_found_action => value_parameter_not_found_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParamRef { + name: value_name, + namespace: value_namespace, + parameter_not_found_action: value_parameter_not_found_action, + selector: value_selector, + }) + } + } + + deserializer.deserialize_struct( + "ParamRef", + &[ + "name", + "namespace", + "parameterNotFoundAction", + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParamRef { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParamRef", + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.parameter_not_found_action.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.parameter_not_found_action { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameterNotFoundAction", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParamRef { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ParamRef".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource being referenced.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.\n\nA single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parameterNotFoundAction".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/type_checking.rs b/src/v1_30/api/admissionregistration/v1beta1/type_checking.rs new file mode 100644 index 000000000..bd9d6ff3d --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/type_checking.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.TypeChecking + +/// TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TypeChecking { + /// The type checking warnings for each expression. + pub expression_warnings: Option>, +} + +impl crate::DeepMerge for TypeChecking { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.expression_warnings, other.expression_warnings); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TypeChecking { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression_warnings, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expressionWarnings" => Field::Key_expression_warnings, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TypeChecking; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TypeChecking") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression_warnings: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression_warnings => value_expression_warnings = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TypeChecking { + expression_warnings: value_expression_warnings, + }) + } + } + + deserializer.deserialize_struct( + "TypeChecking", + &[ + "expressionWarnings", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TypeChecking { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TypeChecking", + self.expression_warnings.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.expression_warnings { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expressionWarnings", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TypeChecking { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.TypeChecking".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expressionWarnings".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The type checking warnings for each expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy.rs b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy.rs new file mode 100644 index 000000000..f60faf4f2 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicy + +/// ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicy { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicy. + pub spec: Option, + + /// The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only. + pub status: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicy { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1beta1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicy"; + const VERSION: &'static str = "v1beta1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicies"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicy { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicy { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicy { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicy { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicy.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding.rs b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding.rs new file mode 100644 index 000000000..af5c4b6f1 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding.rs @@ -0,0 +1,224 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding + +/// ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters. +/// +/// For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. +/// +/// The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBinding { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + pub spec: Option, +} + +impl crate::Resource for ValidatingAdmissionPolicyBinding { + const API_VERSION: &'static str = "admissionregistration.k8s.io/v1beta1"; + const GROUP: &'static str = "admissionregistration.k8s.io"; + const KIND: &'static str = "ValidatingAdmissionPolicyBinding"; + const VERSION: &'static str = "v1beta1"; + const URL_PATH_SEGMENT: &'static str = "validatingadmissionpolicybindings"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ValidatingAdmissionPolicyBinding { + const LIST_KIND: &'static str = "ValidatingAdmissionPolicyBindingList"; +} + +impl crate::Metadata for ValidatingAdmissionPolicyBinding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBinding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBinding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBinding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBinding { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBinding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBinding { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyBinding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding_spec.rs b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding_spec.rs new file mode 100644 index 000000000..ce6e36db9 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_binding_spec.rs @@ -0,0 +1,229 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyBindingSpec + +/// ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyBindingSpec { + /// MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required. + pub match_resources: Option, + + /// paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + pub param_ref: Option, + + /// PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required. + pub policy_name: Option, + + /// validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions. + /// + /// Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy. + /// + /// validationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action. + /// + /// The supported actions values are: + /// + /// "Deny" specifies that a validation failure results in a denied request. + /// + /// "Warn" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses. + /// + /// "Audit" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `"validation.policy.admission.k8s.io/validation_failure": "\[{"message": "Invalid value", {"policy": "policy.example.com", {"binding": "policybinding.example.com", {"expressionIndex": "1", {"validationActions": \["Audit"\]}\]"` + /// + /// Clients should expect to handle additional values by ignoring any values not recognized. + /// + /// "Deny" and "Warn" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers. + /// + /// Required. + pub validation_actions: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyBindingSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.match_resources, other.match_resources); + crate::DeepMerge::merge_from(&mut self.param_ref, other.param_ref); + crate::DeepMerge::merge_from(&mut self.policy_name, other.policy_name); + crate::merge_strategies::list::set(&mut self.validation_actions, other.validation_actions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyBindingSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_resources, + Key_param_ref, + Key_policy_name, + Key_validation_actions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchResources" => Field::Key_match_resources, + "paramRef" => Field::Key_param_ref, + "policyName" => Field::Key_policy_name, + "validationActions" => Field::Key_validation_actions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyBindingSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyBindingSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_resources: Option = None; + let mut value_param_ref: Option = None; + let mut value_policy_name: Option = None; + let mut value_validation_actions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_resources => value_match_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_ref => value_param_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_policy_name => value_policy_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validation_actions => value_validation_actions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyBindingSpec { + match_resources: value_match_resources, + param_ref: value_param_ref, + policy_name: value_policy_name, + validation_actions: value_validation_actions, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + &[ + "matchResources", + "paramRef", + "policyName", + "validationActions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyBindingSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyBindingSpec", + self.match_resources.as_ref().map_or(0, |_| 1) + + self.param_ref.as_ref().map_or(0, |_| 1) + + self.policy_name.as_ref().map_or(0, |_| 1) + + self.validation_actions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchResources", value)?; + } + if let Some(value) = &self.param_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramRef", value)?; + } + if let Some(value) = &self.policy_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "policyName", value)?; + } + if let Some(value) = &self.validation_actions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validationActions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyBindingSpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyBindingSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "policyName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "validationActions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_spec.rs b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_spec.rs new file mode 100644 index 000000000..8f185d2e3 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_spec.rs @@ -0,0 +1,326 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicySpec + +/// ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicySpec { + /// auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required. + pub audit_annotations: Option>, + + /// failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings. + /// + /// A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource. + /// + /// failurePolicy does not define how validations that evaluate to false are handled. + /// + /// When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced. + /// + /// Allowed values are Ignore or Fail. Defaults to Fail. + pub failure_policy: Option, + + /// MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed. + /// + /// If a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions. + /// + /// The exact matching logic is (in order): + /// 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + /// 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + /// 3. If any matchCondition evaluates to an error (but none are FALSE): + /// - If failurePolicy=Fail, reject the request + /// - If failurePolicy=Ignore, the policy is skipped + pub match_conditions: Option>, + + /// MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required. + pub match_constraints: Option, + + /// ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. + pub param_kind: Option, + + /// Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required. + pub validations: Option>, + + /// Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy. + /// + /// The expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic. + pub variables: Option>, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicySpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audit_annotations, other.audit_annotations); + crate::DeepMerge::merge_from(&mut self.failure_policy, other.failure_policy); + crate::merge_strategies::list::map( + &mut self.match_conditions, + other.match_conditions, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.match_constraints, other.match_constraints); + crate::DeepMerge::merge_from(&mut self.param_kind, other.param_kind); + crate::merge_strategies::list::atomic(&mut self.validations, other.validations); + crate::merge_strategies::list::map( + &mut self.variables, + other.variables, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicySpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audit_annotations, + Key_failure_policy, + Key_match_conditions, + Key_match_constraints, + Key_param_kind, + Key_validations, + Key_variables, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "auditAnnotations" => Field::Key_audit_annotations, + "failurePolicy" => Field::Key_failure_policy, + "matchConditions" => Field::Key_match_conditions, + "matchConstraints" => Field::Key_match_constraints, + "paramKind" => Field::Key_param_kind, + "validations" => Field::Key_validations, + "variables" => Field::Key_variables, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicySpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicySpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audit_annotations: Option> = None; + let mut value_failure_policy: Option = None; + let mut value_match_conditions: Option> = None; + let mut value_match_constraints: Option = None; + let mut value_param_kind: Option = None; + let mut value_validations: Option> = None; + let mut value_variables: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audit_annotations => value_audit_annotations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_policy => value_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_conditions => value_match_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_constraints => value_match_constraints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_param_kind => value_param_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_validations => value_validations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_variables => value_variables = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicySpec { + audit_annotations: value_audit_annotations, + failure_policy: value_failure_policy, + match_conditions: value_match_conditions, + match_constraints: value_match_constraints, + param_kind: value_param_kind, + validations: value_validations, + variables: value_variables, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicySpec", + &[ + "auditAnnotations", + "failurePolicy", + "matchConditions", + "matchConstraints", + "paramKind", + "validations", + "variables", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicySpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicySpec", + self.audit_annotations.as_ref().map_or(0, |_| 1) + + self.failure_policy.as_ref().map_or(0, |_| 1) + + self.match_conditions.as_ref().map_or(0, |_| 1) + + self.match_constraints.as_ref().map_or(0, |_| 1) + + self.param_kind.as_ref().map_or(0, |_| 1) + + self.validations.as_ref().map_or(0, |_| 1) + + self.variables.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audit_annotations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "auditAnnotations", value)?; + } + if let Some(value) = &self.failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failurePolicy", value)?; + } + if let Some(value) = &self.match_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConditions", value)?; + } + if let Some(value) = &self.match_constraints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchConstraints", value)?; + } + if let Some(value) = &self.param_kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paramKind", value)?; + } + if let Some(value) = &self.validations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "validations", value)?; + } + if let Some(value) = &self.variables { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "variables", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicySpec { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicySpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "auditAnnotations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "failurePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "matchConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchConstraints".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "paramKind".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "validations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "variables".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_status.rs b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_status.rs new file mode 100644 index 000000000..95f585336 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validating_admission_policy_status.rs @@ -0,0 +1,189 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyStatus + +/// ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidatingAdmissionPolicyStatus { + /// The conditions represent the latest available observations of a policy's current state. + pub conditions: Option>, + + /// The generation observed by the controller. + pub observed_generation: Option, + + /// The results of type checking for each expression. Presence of this field indicates the completion of the type checking. + pub type_checking: Option, +} + +impl crate::DeepMerge for ValidatingAdmissionPolicyStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.type_checking, other.type_checking); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidatingAdmissionPolicyStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_observed_generation, + Key_type_checking, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "observedGeneration" => Field::Key_observed_generation, + "typeChecking" => Field::Key_type_checking, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidatingAdmissionPolicyStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidatingAdmissionPolicyStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_observed_generation: Option = None; + let mut value_type_checking: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_checking => value_type_checking = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidatingAdmissionPolicyStatus { + conditions: value_conditions, + observed_generation: value_observed_generation, + type_checking: value_type_checking, + }) + } + } + + deserializer.deserialize_struct( + "ValidatingAdmissionPolicyStatus", + &[ + "conditions", + "observedGeneration", + "typeChecking", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidatingAdmissionPolicyStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidatingAdmissionPolicyStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.type_checking.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.type_checking { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "typeChecking", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidatingAdmissionPolicyStatus { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.ValidatingAdmissionPolicyStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The conditions represent the latest available observations of a policy's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The generation observed by the controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "typeChecking".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The results of type checking for each expression. Presence of this field indicates the completion of the type checking.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/validation.rs b/src/v1_30/api/admissionregistration/v1beta1/validation.rs new file mode 100644 index 000000000..82f234f2c --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/validation.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.Validation + +/// Validation specifies the CEL expression which is used to apply the validation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Validation { + /// Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: + /// + /// - 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request(\[ref\](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + /// For example, a variable named 'foo' can be accessed as 'variables.foo'. + /// - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + /// See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + /// - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + /// request resource. + /// + /// The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible. + /// + /// Only property names of the form `\[a-zA-Z_.-/\]\[a-zA-Z0-9_.-/\]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + /// "import", "let", "loop", "package", "namespace", "return". + /// Examples: + /// - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ \> 0"} + /// - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop \> 0"} + /// - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d \> 0"} + /// + /// Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. \[1, 2\] == \[2, 1\]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + /// - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + /// non-intersecting elements in `Y` are appended, retaining their partial order. + /// - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + /// are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + /// non-intersecting keys are appended, retaining their partial order. + /// Required. + pub expression: String, + + /// Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is "failed rule: {Rule}". e.g. "must be a URL with the host matching spec.host" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is "failed Expression: {Expression}". + pub message: Option, + + /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: "object.x must be less than max ("+string(params.max)+")" + pub message_expression: Option, + + /// Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge". If not set, StatusReasonInvalid is used in the response to the client. + pub reason: Option, +} + +impl crate::DeepMerge for Validation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.message_expression, other.message_expression); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Validation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_message, + Key_message_expression, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "message" => Field::Key_message, + "messageExpression" => Field::Key_message_expression, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Validation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Validation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_message: Option = None; + let mut value_message_expression: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message_expression => value_message_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Validation { + expression: value_expression.unwrap_or_default(), + message: value_message, + message_expression: value_message_expression, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "Validation", + &[ + "expression", + "message", + "messageExpression", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Validation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Validation", + 1 + + self.message.as_ref().map_or(0, |_| 1) + + self.message_expression.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.message_expression { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "messageExpression", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Validation { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.Validation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Validation specifies the CEL expression which is used to apply the validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "messageExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/admissionregistration/v1beta1/variable.rs b/src/v1_30/api/admissionregistration/v1beta1/variable.rs new file mode 100644 index 000000000..d8b4151a6 --- /dev/null +++ b/src/v1_30/api/admissionregistration/v1beta1/variable.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.admissionregistration.v1beta1.Variable + +/// Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Variable { + /// Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation. + pub expression: String, + + /// Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is "foo", the variable will be available as `variables.foo` + pub name: String, +} + +impl crate::DeepMerge for Variable { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expression, other.expression); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Variable { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expression, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expression" => Field::Key_expression, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Variable; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Variable") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expression: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expression => value_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Variable { + expression: value_expression.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Variable", + &[ + "expression", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Variable { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Variable", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expression", &self.expression)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Variable { + fn schema_name() -> String { + "io.k8s.api.admissionregistration.v1beta1.Variable".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expression".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apiserverinternal/mod.rs b/src/v1_30/api/apiserverinternal/mod.rs new file mode 100644 index 000000000..32a5a9d4f --- /dev/null +++ b/src/v1_30/api/apiserverinternal/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha1; diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/mod.rs b/src/v1_30/api/apiserverinternal/v1alpha1/mod.rs new file mode 100644 index 000000000..ac49a06a0 --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/mod.rs @@ -0,0 +1,15 @@ + +mod server_storage_version; +pub use self::server_storage_version::ServerStorageVersion; + +mod storage_version; +pub use self::storage_version::StorageVersion; + +mod storage_version_condition; +pub use self::storage_version_condition::StorageVersionCondition; + +mod storage_version_spec; +pub use self::storage_version_spec::StorageVersionSpec; + +mod storage_version_status; +pub use self::storage_version_status::StorageVersionStatus; diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/server_storage_version.rs b/src/v1_30/api/apiserverinternal/v1alpha1/server_storage_version.rs new file mode 100644 index 000000000..d0833a103 --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/server_storage_version.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.apiserverinternal.v1alpha1.ServerStorageVersion + +/// An API server instance reports the version it can decode and the version it encodes objects to when persisting objects in the backend. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServerStorageVersion { + /// The ID of the reporting API server. + pub api_server_id: Option, + + /// The API server can decode objects encoded in these versions. The encodingVersion must be included in the decodableVersions. + pub decodable_versions: Option>, + + /// The API server encodes the object to this version when persisting it in the backend (e.g., etcd). + pub encoding_version: Option, + + /// The API server can serve these versions. DecodableVersions must include all ServedVersions. + pub served_versions: Option>, +} + +impl crate::DeepMerge for ServerStorageVersion { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_server_id, other.api_server_id); + crate::merge_strategies::list::set(&mut self.decodable_versions, other.decodable_versions); + crate::DeepMerge::merge_from(&mut self.encoding_version, other.encoding_version); + crate::merge_strategies::list::set(&mut self.served_versions, other.served_versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServerStorageVersion { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_server_id, + Key_decodable_versions, + Key_encoding_version, + Key_served_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiServerID" => Field::Key_api_server_id, + "decodableVersions" => Field::Key_decodable_versions, + "encodingVersion" => Field::Key_encoding_version, + "servedVersions" => Field::Key_served_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServerStorageVersion; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServerStorageVersion") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_server_id: Option = None; + let mut value_decodable_versions: Option> = None; + let mut value_encoding_version: Option = None; + let mut value_served_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_server_id => value_api_server_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_decodable_versions => value_decodable_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_encoding_version => value_encoding_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_served_versions => value_served_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServerStorageVersion { + api_server_id: value_api_server_id, + decodable_versions: value_decodable_versions, + encoding_version: value_encoding_version, + served_versions: value_served_versions, + }) + } + } + + deserializer.deserialize_struct( + "ServerStorageVersion", + &[ + "apiServerID", + "decodableVersions", + "encodingVersion", + "servedVersions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServerStorageVersion { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServerStorageVersion", + self.api_server_id.as_ref().map_or(0, |_| 1) + + self.decodable_versions.as_ref().map_or(0, |_| 1) + + self.encoding_version.as_ref().map_or(0, |_| 1) + + self.served_versions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_server_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiServerID", value)?; + } + if let Some(value) = &self.decodable_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "decodableVersions", value)?; + } + if let Some(value) = &self.encoding_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "encodingVersion", value)?; + } + if let Some(value) = &self.served_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "servedVersions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServerStorageVersion { + fn schema_name() -> String { + "io.k8s.api.apiserverinternal.v1alpha1.ServerStorageVersion".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An API server instance reports the version it can decode and the version it encodes objects to when persisting objects in the backend.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiServerID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The ID of the reporting API server.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "decodableVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The API server can decode objects encoded in these versions. The encodingVersion must be included in the decodableVersions.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "encodingVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The API server encodes the object to this version when persisting it in the backend (e.g., etcd).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "servedVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The API server can serve these versions. DecodableVersions must include all ServedVersions.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/storage_version.rs b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version.rs new file mode 100644 index 000000000..447818b5b --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version.rs @@ -0,0 +1,241 @@ +// Generated from definition io.k8s.api.apiserverinternal.v1alpha1.StorageVersion + +/// Storage version of a specific resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersion { + /// The name is \.\. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec is an empty spec. It is here to comply with Kubernetes API style. + pub spec: crate::api::apiserverinternal::v1alpha1::StorageVersionSpec, + + /// API server instances report the version they can decode and the version they encode objects to when persisting objects in the backend. + pub status: crate::api::apiserverinternal::v1alpha1::StorageVersionStatus, +} + +impl crate::Resource for StorageVersion { + const API_VERSION: &'static str = "internal.apiserver.k8s.io/v1alpha1"; + const GROUP: &'static str = "internal.apiserver.k8s.io"; + const KIND: &'static str = "StorageVersion"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "storageversions"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for StorageVersion { + const LIST_KIND: &'static str = "StorageVersionList"; +} + +impl crate::Metadata for StorageVersion { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for StorageVersion { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersion { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersion; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersion { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersion { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 5, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersion { + fn schema_name() -> String { + "io.k8s.api.apiserverinternal.v1alpha1.StorageVersion".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Storage version of a specific resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name is ..".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec is an empty spec. It is here to comply with Kubernetes API style.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("API server instances report the version they can decode and the version they encode objects to when persisting objects in the backend.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + "status".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_condition.rs b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_condition.rs new file mode 100644 index 000000000..a64dfc69e --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_condition.rs @@ -0,0 +1,248 @@ +// Generated from definition io.k8s.api.apiserverinternal.v1alpha1.StorageVersionCondition + +/// Describes the state of the storageVersion at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionCondition { + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// A human readable message indicating details about the transition. + pub message: String, + + /// If set, this represents the .metadata.generation that the condition was set based upon. + pub observed_generation: Option, + + /// The reason for the condition's last transition. + pub reason: String, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of the condition. + pub type_: String, +} + +impl crate::DeepMerge for StorageVersionCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_observed_generation, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "observedGeneration" => Field::Key_observed_generation, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageVersionCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_observed_generation: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersionCondition { + last_transition_time: value_last_transition_time, + message: value_message.unwrap_or_default(), + observed_generation: value_observed_generation, + reason: value_reason.unwrap_or_default(), + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "StorageVersionCondition", + &[ + "lastTransitionTime", + "message", + "observedGeneration", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersionCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageVersionCondition", + 4 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", &self.message)?; + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", &self.reason)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionCondition { + fn schema_name() -> String { + "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes the state of the storageVersion at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If set, this represents the .metadata.generation that the condition was set based upon.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of the condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "message".to_owned(), + "reason".to_owned(), + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_spec.rs b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_spec.rs new file mode 100644 index 000000000..316e626c8 --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_spec.rs @@ -0,0 +1,55 @@ +// Generated from definition io.k8s.api.apiserverinternal.v1alpha1.StorageVersionSpec + +/// StorageVersionSpec is an empty spec. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionSpec(pub crate::serde_json::Value); + +impl crate::DeepMerge for StorageVersionSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageVersionSpec") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(StorageVersionSpec(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("StorageVersionSpec", Visitor) + } +} + +impl crate::serde::Serialize for StorageVersionSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("StorageVersionSpec", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionSpec { + fn schema_name() -> String { + "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StorageVersionSpec is an empty spec.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_status.rs b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_status.rs new file mode 100644 index 000000000..0d5b9bd3a --- /dev/null +++ b/src/v1_30/api/apiserverinternal/v1alpha1/storage_version_status.rs @@ -0,0 +1,199 @@ +// Generated from definition io.k8s.api.apiserverinternal.v1alpha1.StorageVersionStatus + +/// API server instances report the versions they can decode and the version they encode objects to when persisting objects in the backend. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionStatus { + /// If all API server instances agree on the same encoding storage version, then this field is set to that version. Otherwise this field is left empty. API servers should finish updating its storageVersionStatus entry before serving write operations, so that this field will be in sync with the reality. + pub common_encoding_version: Option, + + /// The latest available observations of the storageVersion's state. + pub conditions: Option>, + + /// The reported versions per API server instance. + pub storage_versions: Option>, +} + +impl crate::DeepMerge for StorageVersionStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.common_encoding_version, other.common_encoding_version); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.storage_versions, + other.storage_versions, + &[|lhs, rhs| lhs.api_server_id == rhs.api_server_id], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_common_encoding_version, + Key_conditions, + Key_storage_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "commonEncodingVersion" => Field::Key_common_encoding_version, + "conditions" => Field::Key_conditions, + "storageVersions" => Field::Key_storage_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageVersionStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_common_encoding_version: Option = None; + let mut value_conditions: Option> = None; + let mut value_storage_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_common_encoding_version => value_common_encoding_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_versions => value_storage_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersionStatus { + common_encoding_version: value_common_encoding_version, + conditions: value_conditions, + storage_versions: value_storage_versions, + }) + } + } + + deserializer.deserialize_struct( + "StorageVersionStatus", + &[ + "commonEncodingVersion", + "conditions", + "storageVersions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersionStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageVersionStatus", + self.common_encoding_version.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.storage_versions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.common_encoding_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "commonEncodingVersion", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.storage_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageVersions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionStatus { + fn schema_name() -> String { + "io.k8s.api.apiserverinternal.v1alpha1.StorageVersionStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("API server instances report the versions they can decode and the version they encode objects to when persisting objects in the backend.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "commonEncodingVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If all API server instances agree on the same encoding storage version, then this field is set to that version. Otherwise this field is left empty. API servers should finish updating its storageVersionStatus entry before serving write operations, so that this field will be in sync with the reality.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The latest available observations of the storageVersion's state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "storageVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reported versions per API server instance.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/mod.rs b/src/v1_30/api/apps/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/apps/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/apps/v1/controller_revision.rs b/src/v1_30/api/apps/v1/controller_revision.rs new file mode 100644 index 000000000..e2e66790e --- /dev/null +++ b/src/v1_30/api/apps/v1/controller_revision.rs @@ -0,0 +1,244 @@ +// Generated from definition io.k8s.api.apps.v1.ControllerRevision + +/// ControllerRevision implements an immutable snapshot of state data. Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ControllerRevision { + /// Data is the serialized representation of the state. + pub data: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Revision indicates the revision of the state represented by Data. + pub revision: i64, +} + +impl crate::Resource for ControllerRevision { + const API_VERSION: &'static str = "apps/v1"; + const GROUP: &'static str = "apps"; + const KIND: &'static str = "ControllerRevision"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "controllerrevisions"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ControllerRevision { + const LIST_KIND: &'static str = "ControllerRevisionList"; +} + +impl crate::Metadata for ControllerRevision { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ControllerRevision { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.data, other.data); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.revision, other.revision); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ControllerRevision { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_data, + Key_metadata, + Key_revision, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "data" => Field::Key_data, + "metadata" => Field::Key_metadata, + "revision" => Field::Key_revision, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ControllerRevision; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_data: Option = None; + let mut value_metadata: Option = None; + let mut value_revision: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_data => value_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_revision => value_revision = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ControllerRevision { + data: value_data, + metadata: value_metadata.unwrap_or_default(), + revision: value_revision.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "data", + "metadata", + "revision", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ControllerRevision { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.data.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "data", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "revision", &self.revision)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ControllerRevision { + fn schema_name() -> String { + "io.k8s.api.apps.v1.ControllerRevision".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ControllerRevision implements an immutable snapshot of state data. Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "data".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Data is the serialized representation of the state.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "revision".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Revision indicates the revision of the state represented by Data.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "revision".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/daemon_set.rs b/src/v1_30/api/apps/v1/daemon_set.rs new file mode 100644 index 000000000..b1b5ea726 --- /dev/null +++ b/src/v1_30/api/apps/v1/daemon_set.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.apps.v1.DaemonSet + +/// DaemonSet represents the configuration of a daemon set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonSet { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// The desired behavior of this daemon set. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// The current status of this daemon set. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for DaemonSet { + const API_VERSION: &'static str = "apps/v1"; + const GROUP: &'static str = "apps"; + const KIND: &'static str = "DaemonSet"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "daemonsets"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for DaemonSet { + const LIST_KIND: &'static str = "DaemonSetList"; +} + +impl crate::Metadata for DaemonSet { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for DaemonSet { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonSet { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonSet; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonSet { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonSet { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonSet { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DaemonSet".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonSet represents the configuration of a daemon set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The desired behavior of this daemon set. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The current status of this daemon set. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/daemon_set_condition.rs b/src/v1_30/api/apps/v1/daemon_set_condition.rs new file mode 100644 index 000000000..087e927ff --- /dev/null +++ b/src/v1_30/api/apps/v1/daemon_set_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.apps.v1.DaemonSetCondition + +/// DaemonSetCondition describes the state of a DaemonSet at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonSetCondition { + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of DaemonSet condition. + pub type_: String, +} + +impl crate::DeepMerge for DaemonSetCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonSetCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonSetCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DaemonSetCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonSetCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "DaemonSetCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonSetCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DaemonSetCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonSetCondition { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DaemonSetCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonSetCondition describes the state of a DaemonSet at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of DaemonSet condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/daemon_set_spec.rs b/src/v1_30/api/apps/v1/daemon_set_spec.rs new file mode 100644 index 000000000..e644fa390 --- /dev/null +++ b/src/v1_30/api/apps/v1/daemon_set_spec.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.apps.v1.DaemonSetSpec + +/// DaemonSetSpec is the specification of a daemon set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonSetSpec { + /// The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready). + pub min_ready_seconds: Option, + + /// The number of old history to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. + pub revision_history_limit: Option, + + /// A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + pub selector: crate::apimachinery::pkg::apis::meta::v1::LabelSelector, + + /// An object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). The only allowed template.spec.restartPolicy value is "Always". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + pub template: crate::api::core::v1::PodTemplateSpec, + + /// An update strategy to replace existing DaemonSet pods with new pods. + pub update_strategy: Option, +} + +impl crate::DeepMerge for DaemonSetSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.min_ready_seconds, other.min_ready_seconds); + crate::DeepMerge::merge_from(&mut self.revision_history_limit, other.revision_history_limit); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.template, other.template); + crate::DeepMerge::merge_from(&mut self.update_strategy, other.update_strategy); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonSetSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_min_ready_seconds, + Key_revision_history_limit, + Key_selector, + Key_template, + Key_update_strategy, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "minReadySeconds" => Field::Key_min_ready_seconds, + "revisionHistoryLimit" => Field::Key_revision_history_limit, + "selector" => Field::Key_selector, + "template" => Field::Key_template, + "updateStrategy" => Field::Key_update_strategy, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonSetSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DaemonSetSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_min_ready_seconds: Option = None; + let mut value_revision_history_limit: Option = None; + let mut value_selector: Option = None; + let mut value_template: Option = None; + let mut value_update_strategy: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_min_ready_seconds => value_min_ready_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_revision_history_limit => value_revision_history_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_update_strategy => value_update_strategy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonSetSpec { + min_ready_seconds: value_min_ready_seconds, + revision_history_limit: value_revision_history_limit, + selector: value_selector.unwrap_or_default(), + template: value_template.unwrap_or_default(), + update_strategy: value_update_strategy, + }) + } + } + + deserializer.deserialize_struct( + "DaemonSetSpec", + &[ + "minReadySeconds", + "revisionHistoryLimit", + "selector", + "template", + "updateStrategy", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonSetSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DaemonSetSpec", + 2 + + self.min_ready_seconds.as_ref().map_or(0, |_| 1) + + self.revision_history_limit.as_ref().map_or(0, |_| 1) + + self.update_strategy.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.min_ready_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReadySeconds", value)?; + } + if let Some(value) = &self.revision_history_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "revisionHistoryLimit", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?; + if let Some(value) = &self.update_strategy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updateStrategy", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonSetSpec { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DaemonSetSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonSetSpec is the specification of a daemon set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "minReadySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "revisionHistoryLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of old history to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). The only allowed template.spec.restartPolicy value is \"Always\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "updateStrategy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An update strategy to replace existing DaemonSet pods with new pods.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "selector".to_owned(), + "template".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/daemon_set_status.rs b/src/v1_30/api/apps/v1/daemon_set_status.rs new file mode 100644 index 000000000..345f5eb65 --- /dev/null +++ b/src/v1_30/api/apps/v1/daemon_set_status.rs @@ -0,0 +1,367 @@ +// Generated from definition io.k8s.api.apps.v1.DaemonSetStatus + +/// DaemonSetStatus represents the current status of a daemon set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonSetStatus { + /// Count of hash collisions for the DaemonSet. The DaemonSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision. + pub collision_count: Option, + + /// Represents the latest available observations of a DaemonSet's current state. + pub conditions: Option>, + + /// The number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + pub current_number_scheduled: i32, + + /// The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + pub desired_number_scheduled: i32, + + /// The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds) + pub number_available: Option, + + /// The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + pub number_misscheduled: i32, + + /// numberReady is the number of nodes that should be running the daemon pod and have one or more of the daemon pod running with a Ready Condition. + pub number_ready: i32, + + /// The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds) + pub number_unavailable: Option, + + /// The most recent generation observed by the daemon set controller. + pub observed_generation: Option, + + /// The total number of nodes that are running updated daemon pod + pub updated_number_scheduled: Option, +} + +impl crate::DeepMerge for DaemonSetStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.collision_count, other.collision_count); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.current_number_scheduled, other.current_number_scheduled); + crate::DeepMerge::merge_from(&mut self.desired_number_scheduled, other.desired_number_scheduled); + crate::DeepMerge::merge_from(&mut self.number_available, other.number_available); + crate::DeepMerge::merge_from(&mut self.number_misscheduled, other.number_misscheduled); + crate::DeepMerge::merge_from(&mut self.number_ready, other.number_ready); + crate::DeepMerge::merge_from(&mut self.number_unavailable, other.number_unavailable); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.updated_number_scheduled, other.updated_number_scheduled); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonSetStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_collision_count, + Key_conditions, + Key_current_number_scheduled, + Key_desired_number_scheduled, + Key_number_available, + Key_number_misscheduled, + Key_number_ready, + Key_number_unavailable, + Key_observed_generation, + Key_updated_number_scheduled, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "collisionCount" => Field::Key_collision_count, + "conditions" => Field::Key_conditions, + "currentNumberScheduled" => Field::Key_current_number_scheduled, + "desiredNumberScheduled" => Field::Key_desired_number_scheduled, + "numberAvailable" => Field::Key_number_available, + "numberMisscheduled" => Field::Key_number_misscheduled, + "numberReady" => Field::Key_number_ready, + "numberUnavailable" => Field::Key_number_unavailable, + "observedGeneration" => Field::Key_observed_generation, + "updatedNumberScheduled" => Field::Key_updated_number_scheduled, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonSetStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DaemonSetStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_collision_count: Option = None; + let mut value_conditions: Option> = None; + let mut value_current_number_scheduled: Option = None; + let mut value_desired_number_scheduled: Option = None; + let mut value_number_available: Option = None; + let mut value_number_misscheduled: Option = None; + let mut value_number_ready: Option = None; + let mut value_number_unavailable: Option = None; + let mut value_observed_generation: Option = None; + let mut value_updated_number_scheduled: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_collision_count => value_collision_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_number_scheduled => value_current_number_scheduled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_desired_number_scheduled => value_desired_number_scheduled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_number_available => value_number_available = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_number_misscheduled => value_number_misscheduled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_number_ready => value_number_ready = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_number_unavailable => value_number_unavailable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_updated_number_scheduled => value_updated_number_scheduled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonSetStatus { + collision_count: value_collision_count, + conditions: value_conditions, + current_number_scheduled: value_current_number_scheduled.unwrap_or_default(), + desired_number_scheduled: value_desired_number_scheduled.unwrap_or_default(), + number_available: value_number_available, + number_misscheduled: value_number_misscheduled.unwrap_or_default(), + number_ready: value_number_ready.unwrap_or_default(), + number_unavailable: value_number_unavailable, + observed_generation: value_observed_generation, + updated_number_scheduled: value_updated_number_scheduled, + }) + } + } + + deserializer.deserialize_struct( + "DaemonSetStatus", + &[ + "collisionCount", + "conditions", + "currentNumberScheduled", + "desiredNumberScheduled", + "numberAvailable", + "numberMisscheduled", + "numberReady", + "numberUnavailable", + "observedGeneration", + "updatedNumberScheduled", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonSetStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DaemonSetStatus", + 4 + + self.collision_count.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.number_available.as_ref().map_or(0, |_| 1) + + self.number_unavailable.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.updated_number_scheduled.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.collision_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "collisionCount", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentNumberScheduled", &self.current_number_scheduled)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "desiredNumberScheduled", &self.desired_number_scheduled)?; + if let Some(value) = &self.number_available { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "numberAvailable", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "numberMisscheduled", &self.number_misscheduled)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "numberReady", &self.number_ready)?; + if let Some(value) = &self.number_unavailable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "numberUnavailable", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.updated_number_scheduled { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updatedNumberScheduled", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonSetStatus { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DaemonSetStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonSetStatus represents the current status of a daemon set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "collisionCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Count of hash collisions for the DaemonSet. The DaemonSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a DaemonSet's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentNumberScheduled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "desiredNumberScheduled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "numberAvailable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "numberMisscheduled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "numberReady".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("numberReady is the number of nodes that should be running the daemon pod and have one or more of the daemon pod running with a Ready Condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "numberUnavailable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The most recent generation observed by the daemon set controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "updatedNumberScheduled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The total number of nodes that are running updated daemon pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "currentNumberScheduled".to_owned(), + "desiredNumberScheduled".to_owned(), + "numberMisscheduled".to_owned(), + "numberReady".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/daemon_set_update_strategy.rs b/src/v1_30/api/apps/v1/daemon_set_update_strategy.rs new file mode 100644 index 000000000..44129912e --- /dev/null +++ b/src/v1_30/api/apps/v1/daemon_set_update_strategy.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.DaemonSetUpdateStrategy + +/// DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonSetUpdateStrategy { + /// Rolling update config params. Present only if type = "RollingUpdate". + pub rolling_update: Option, + + /// Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate. + pub type_: Option, +} + +impl crate::DeepMerge for DaemonSetUpdateStrategy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.rolling_update, other.rolling_update); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonSetUpdateStrategy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_rolling_update, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "rollingUpdate" => Field::Key_rolling_update, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonSetUpdateStrategy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DaemonSetUpdateStrategy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_rolling_update: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_rolling_update => value_rolling_update = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonSetUpdateStrategy { + rolling_update: value_rolling_update, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "DaemonSetUpdateStrategy", + &[ + "rollingUpdate", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonSetUpdateStrategy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DaemonSetUpdateStrategy", + self.rolling_update.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.rolling_update { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rollingUpdate", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonSetUpdateStrategy { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DaemonSetUpdateStrategy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "rollingUpdate".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rolling update config params. Present only if type = \"RollingUpdate\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of daemon set update. Can be \"RollingUpdate\" or \"OnDelete\". Default is RollingUpdate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/deployment.rs b/src/v1_30/api/apps/v1/deployment.rs new file mode 100644 index 000000000..c70dc8e42 --- /dev/null +++ b/src/v1_30/api/apps/v1/deployment.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.apps.v1.Deployment + +/// Deployment enables declarative updates for Pods and ReplicaSets. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Deployment { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the Deployment. + pub spec: Option, + + /// Most recently observed status of the Deployment. + pub status: Option, +} + +impl crate::Resource for Deployment { + const API_VERSION: &'static str = "apps/v1"; + const GROUP: &'static str = "apps"; + const KIND: &'static str = "Deployment"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "deployments"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Deployment { + const LIST_KIND: &'static str = "DeploymentList"; +} + +impl crate::Metadata for Deployment { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Deployment { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Deployment { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Deployment; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Deployment { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Deployment { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Deployment { + fn schema_name() -> String { + "io.k8s.api.apps.v1.Deployment".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deployment enables declarative updates for Pods and ReplicaSets.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the Deployment.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recently observed status of the Deployment.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/deployment_condition.rs b/src/v1_30/api/apps/v1/deployment_condition.rs new file mode 100644 index 000000000..637b9710e --- /dev/null +++ b/src/v1_30/api/apps/v1/deployment_condition.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.apps.v1.DeploymentCondition + +/// DeploymentCondition describes the state of a deployment at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DeploymentCondition { + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// The last time this condition was updated. + pub last_update_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of deployment condition. + pub type_: String, +} + +impl crate::DeepMerge for DeploymentCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.last_update_time, other.last_update_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DeploymentCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_last_update_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "lastUpdateTime" => Field::Key_last_update_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DeploymentCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeploymentCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_last_update_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_update_time => value_last_update_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DeploymentCondition { + last_transition_time: value_last_transition_time, + last_update_time: value_last_update_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "DeploymentCondition", + &[ + "lastTransitionTime", + "lastUpdateTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DeploymentCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeploymentCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.last_update_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.last_update_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastUpdateTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DeploymentCondition { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DeploymentCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeploymentCondition describes the state of a deployment at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastUpdateTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The last time this condition was updated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of deployment condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/deployment_spec.rs b/src/v1_30/api/apps/v1/deployment_spec.rs new file mode 100644 index 000000000..26d5657f6 --- /dev/null +++ b/src/v1_30/api/apps/v1/deployment_spec.rs @@ -0,0 +1,305 @@ +// Generated from definition io.k8s.api.apps.v1.DeploymentSpec + +/// DeploymentSpec is the specification of the desired behavior of the Deployment. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DeploymentSpec { + /// Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready) + pub min_ready_seconds: Option, + + /// Indicates that the deployment is paused. + pub paused: Option, + + /// The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s. + pub progress_deadline_seconds: Option, + + /// Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1. + pub replicas: Option, + + /// The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. + pub revision_history_limit: Option, + + /// Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels. + pub selector: crate::apimachinery::pkg::apis::meta::v1::LabelSelector, + + /// The deployment strategy to use to replace existing pods with new ones. + pub strategy: Option, + + /// Template describes the pods that will be created. The only allowed template.spec.restartPolicy value is "Always". + pub template: crate::api::core::v1::PodTemplateSpec, +} + +impl crate::DeepMerge for DeploymentSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.min_ready_seconds, other.min_ready_seconds); + crate::DeepMerge::merge_from(&mut self.paused, other.paused); + crate::DeepMerge::merge_from(&mut self.progress_deadline_seconds, other.progress_deadline_seconds); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.revision_history_limit, other.revision_history_limit); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.strategy, other.strategy); + crate::DeepMerge::merge_from(&mut self.template, other.template); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DeploymentSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_min_ready_seconds, + Key_paused, + Key_progress_deadline_seconds, + Key_replicas, + Key_revision_history_limit, + Key_selector, + Key_strategy, + Key_template, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "minReadySeconds" => Field::Key_min_ready_seconds, + "paused" => Field::Key_paused, + "progressDeadlineSeconds" => Field::Key_progress_deadline_seconds, + "replicas" => Field::Key_replicas, + "revisionHistoryLimit" => Field::Key_revision_history_limit, + "selector" => Field::Key_selector, + "strategy" => Field::Key_strategy, + "template" => Field::Key_template, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DeploymentSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeploymentSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_min_ready_seconds: Option = None; + let mut value_paused: Option = None; + let mut value_progress_deadline_seconds: Option = None; + let mut value_replicas: Option = None; + let mut value_revision_history_limit: Option = None; + let mut value_selector: Option = None; + let mut value_strategy: Option = None; + let mut value_template: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_min_ready_seconds => value_min_ready_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_paused => value_paused = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_progress_deadline_seconds => value_progress_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_revision_history_limit => value_revision_history_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_strategy => value_strategy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DeploymentSpec { + min_ready_seconds: value_min_ready_seconds, + paused: value_paused, + progress_deadline_seconds: value_progress_deadline_seconds, + replicas: value_replicas, + revision_history_limit: value_revision_history_limit, + selector: value_selector.unwrap_or_default(), + strategy: value_strategy, + template: value_template.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "DeploymentSpec", + &[ + "minReadySeconds", + "paused", + "progressDeadlineSeconds", + "replicas", + "revisionHistoryLimit", + "selector", + "strategy", + "template", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DeploymentSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeploymentSpec", + 2 + + self.min_ready_seconds.as_ref().map_or(0, |_| 1) + + self.paused.as_ref().map_or(0, |_| 1) + + self.progress_deadline_seconds.as_ref().map_or(0, |_| 1) + + self.replicas.as_ref().map_or(0, |_| 1) + + self.revision_history_limit.as_ref().map_or(0, |_| 1) + + self.strategy.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.min_ready_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReadySeconds", value)?; + } + if let Some(value) = &self.paused { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paused", value)?; + } + if let Some(value) = &self.progress_deadline_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "progressDeadlineSeconds", value)?; + } + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + if let Some(value) = &self.revision_history_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "revisionHistoryLimit", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + if let Some(value) = &self.strategy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "strategy", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DeploymentSpec { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DeploymentSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeploymentSpec is the specification of the desired behavior of the Deployment.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "minReadySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "paused".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Indicates that the deployment is paused.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "progressDeadlineSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "revisionHistoryLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "strategy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The deployment strategy to use to replace existing pods with new ones.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Template describes the pods that will be created. The only allowed template.spec.restartPolicy value is \"Always\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "selector".to_owned(), + "template".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/deployment_status.rs b/src/v1_30/api/apps/v1/deployment_status.rs new file mode 100644 index 000000000..ee140e108 --- /dev/null +++ b/src/v1_30/api/apps/v1/deployment_status.rs @@ -0,0 +1,320 @@ +// Generated from definition io.k8s.api.apps.v1.DeploymentStatus + +/// DeploymentStatus is the most recently observed status of the Deployment. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DeploymentStatus { + /// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. + pub available_replicas: Option, + + /// Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet. + pub collision_count: Option, + + /// Represents the latest available observations of a deployment's current state. + pub conditions: Option>, + + /// The generation observed by the deployment controller. + pub observed_generation: Option, + + /// readyReplicas is the number of pods targeted by this Deployment with a Ready Condition. + pub ready_replicas: Option, + + /// Total number of non-terminated pods targeted by this deployment (their labels match the selector). + pub replicas: Option, + + /// Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created. + pub unavailable_replicas: Option, + + /// Total number of non-terminated pods targeted by this deployment that have the desired template spec. + pub updated_replicas: Option, +} + +impl crate::DeepMerge for DeploymentStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.available_replicas, other.available_replicas); + crate::DeepMerge::merge_from(&mut self.collision_count, other.collision_count); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.ready_replicas, other.ready_replicas); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.unavailable_replicas, other.unavailable_replicas); + crate::DeepMerge::merge_from(&mut self.updated_replicas, other.updated_replicas); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DeploymentStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_available_replicas, + Key_collision_count, + Key_conditions, + Key_observed_generation, + Key_ready_replicas, + Key_replicas, + Key_unavailable_replicas, + Key_updated_replicas, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "availableReplicas" => Field::Key_available_replicas, + "collisionCount" => Field::Key_collision_count, + "conditions" => Field::Key_conditions, + "observedGeneration" => Field::Key_observed_generation, + "readyReplicas" => Field::Key_ready_replicas, + "replicas" => Field::Key_replicas, + "unavailableReplicas" => Field::Key_unavailable_replicas, + "updatedReplicas" => Field::Key_updated_replicas, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DeploymentStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeploymentStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_available_replicas: Option = None; + let mut value_collision_count: Option = None; + let mut value_conditions: Option> = None; + let mut value_observed_generation: Option = None; + let mut value_ready_replicas: Option = None; + let mut value_replicas: Option = None; + let mut value_unavailable_replicas: Option = None; + let mut value_updated_replicas: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_available_replicas => value_available_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_collision_count => value_collision_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready_replicas => value_ready_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_unavailable_replicas => value_unavailable_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_updated_replicas => value_updated_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DeploymentStatus { + available_replicas: value_available_replicas, + collision_count: value_collision_count, + conditions: value_conditions, + observed_generation: value_observed_generation, + ready_replicas: value_ready_replicas, + replicas: value_replicas, + unavailable_replicas: value_unavailable_replicas, + updated_replicas: value_updated_replicas, + }) + } + } + + deserializer.deserialize_struct( + "DeploymentStatus", + &[ + "availableReplicas", + "collisionCount", + "conditions", + "observedGeneration", + "readyReplicas", + "replicas", + "unavailableReplicas", + "updatedReplicas", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DeploymentStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeploymentStatus", + self.available_replicas.as_ref().map_or(0, |_| 1) + + self.collision_count.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.ready_replicas.as_ref().map_or(0, |_| 1) + + self.replicas.as_ref().map_or(0, |_| 1) + + self.unavailable_replicas.as_ref().map_or(0, |_| 1) + + self.updated_replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.available_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "availableReplicas", value)?; + } + if let Some(value) = &self.collision_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "collisionCount", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.ready_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readyReplicas", value)?; + } + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + if let Some(value) = &self.unavailable_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "unavailableReplicas", value)?; + } + if let Some(value) = &self.updated_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updatedReplicas", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DeploymentStatus { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DeploymentStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeploymentStatus is the most recently observed status of the Deployment.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "availableReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "collisionCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a deployment's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The generation observed by the deployment controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "readyReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Total number of non-terminated pods targeted by this deployment (their labels match the selector).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "unavailableReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "updatedReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Total number of non-terminated pods targeted by this deployment that have the desired template spec.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/deployment_strategy.rs b/src/v1_30/api/apps/v1/deployment_strategy.rs new file mode 100644 index 000000000..3f0ef1a1e --- /dev/null +++ b/src/v1_30/api/apps/v1/deployment_strategy.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.DeploymentStrategy + +/// DeploymentStrategy describes how to replace existing pods with new ones. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DeploymentStrategy { + /// Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate. + pub rolling_update: Option, + + /// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. + pub type_: Option, +} + +impl crate::DeepMerge for DeploymentStrategy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.rolling_update, other.rolling_update); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DeploymentStrategy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_rolling_update, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "rollingUpdate" => Field::Key_rolling_update, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DeploymentStrategy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeploymentStrategy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_rolling_update: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_rolling_update => value_rolling_update = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DeploymentStrategy { + rolling_update: value_rolling_update, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "DeploymentStrategy", + &[ + "rollingUpdate", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DeploymentStrategy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeploymentStrategy", + self.rolling_update.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.rolling_update { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rollingUpdate", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DeploymentStrategy { + fn schema_name() -> String { + "io.k8s.api.apps.v1.DeploymentStrategy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeploymentStrategy describes how to replace existing pods with new ones.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "rollingUpdate".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/mod.rs b/src/v1_30/api/apps/v1/mod.rs new file mode 100644 index 000000000..9471f6ea8 --- /dev/null +++ b/src/v1_30/api/apps/v1/mod.rs @@ -0,0 +1,75 @@ + +mod controller_revision; +pub use self::controller_revision::ControllerRevision; + +mod daemon_set; +pub use self::daemon_set::DaemonSet; + +mod daemon_set_condition; +pub use self::daemon_set_condition::DaemonSetCondition; + +mod daemon_set_spec; +pub use self::daemon_set_spec::DaemonSetSpec; + +mod daemon_set_status; +pub use self::daemon_set_status::DaemonSetStatus; + +mod daemon_set_update_strategy; +pub use self::daemon_set_update_strategy::DaemonSetUpdateStrategy; + +mod deployment; +pub use self::deployment::Deployment; + +mod deployment_condition; +pub use self::deployment_condition::DeploymentCondition; + +mod deployment_spec; +pub use self::deployment_spec::DeploymentSpec; + +mod deployment_status; +pub use self::deployment_status::DeploymentStatus; + +mod deployment_strategy; +pub use self::deployment_strategy::DeploymentStrategy; + +mod replica_set; +pub use self::replica_set::ReplicaSet; + +mod replica_set_condition; +pub use self::replica_set_condition::ReplicaSetCondition; + +mod replica_set_spec; +pub use self::replica_set_spec::ReplicaSetSpec; + +mod replica_set_status; +pub use self::replica_set_status::ReplicaSetStatus; + +mod rolling_update_daemon_set; +pub use self::rolling_update_daemon_set::RollingUpdateDaemonSet; + +mod rolling_update_deployment; +pub use self::rolling_update_deployment::RollingUpdateDeployment; + +mod rolling_update_stateful_set_strategy; +pub use self::rolling_update_stateful_set_strategy::RollingUpdateStatefulSetStrategy; + +mod stateful_set; +pub use self::stateful_set::StatefulSet; + +mod stateful_set_condition; +pub use self::stateful_set_condition::StatefulSetCondition; + +mod stateful_set_ordinals; +pub use self::stateful_set_ordinals::StatefulSetOrdinals; + +mod stateful_set_persistent_volume_claim_retention_policy; +pub use self::stateful_set_persistent_volume_claim_retention_policy::StatefulSetPersistentVolumeClaimRetentionPolicy; + +mod stateful_set_spec; +pub use self::stateful_set_spec::StatefulSetSpec; + +mod stateful_set_status; +pub use self::stateful_set_status::StatefulSetStatus; + +mod stateful_set_update_strategy; +pub use self::stateful_set_update_strategy::StatefulSetUpdateStrategy; diff --git a/src/v1_30/api/apps/v1/replica_set.rs b/src/v1_30/api/apps/v1/replica_set.rs new file mode 100644 index 000000000..fd169d56a --- /dev/null +++ b/src/v1_30/api/apps/v1/replica_set.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.apps.v1.ReplicaSet + +/// ReplicaSet ensures that a specified number of pod replicas are running at any given time. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicaSet { + /// If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the specification of the desired behavior of the ReplicaSet. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Status is the most recently observed status of the ReplicaSet. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for ReplicaSet { + const API_VERSION: &'static str = "apps/v1"; + const GROUP: &'static str = "apps"; + const KIND: &'static str = "ReplicaSet"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "replicasets"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ReplicaSet { + const LIST_KIND: &'static str = "ReplicaSetList"; +} + +impl crate::Metadata for ReplicaSet { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ReplicaSet { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicaSet { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicaSet; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicaSet { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicaSet { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicaSet { + fn schema_name() -> String { + "io.k8s.api.apps.v1.ReplicaSet".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicaSet ensures that a specified number of pod replicas are running at any given time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the specification of the desired behavior of the ReplicaSet. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is the most recently observed status of the ReplicaSet. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/replica_set_condition.rs b/src/v1_30/api/apps/v1/replica_set_condition.rs new file mode 100644 index 000000000..78cbdfa62 --- /dev/null +++ b/src/v1_30/api/apps/v1/replica_set_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.apps.v1.ReplicaSetCondition + +/// ReplicaSetCondition describes the state of a replica set at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicaSetCondition { + /// The last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of replica set condition. + pub type_: String, +} + +impl crate::DeepMerge for ReplicaSetCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicaSetCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicaSetCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicaSetCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicaSetCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ReplicaSetCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicaSetCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicaSetCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicaSetCondition { + fn schema_name() -> String { + "io.k8s.api.apps.v1.ReplicaSetCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicaSetCondition describes the state of a replica set at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of replica set condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/replica_set_spec.rs b/src/v1_30/api/apps/v1/replica_set_spec.rs new file mode 100644 index 000000000..19629aa77 --- /dev/null +++ b/src/v1_30/api/apps/v1/replica_set_spec.rs @@ -0,0 +1,205 @@ +// Generated from definition io.k8s.api.apps.v1.ReplicaSetSpec + +/// ReplicaSetSpec is the specification of a ReplicaSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicaSetSpec { + /// Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready) + pub min_ready_seconds: Option, + + /// Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller + pub replicas: Option, + + /// Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + pub selector: crate::apimachinery::pkg::apis::meta::v1::LabelSelector, + + /// Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + pub template: Option, +} + +impl crate::DeepMerge for ReplicaSetSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.min_ready_seconds, other.min_ready_seconds); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.template, other.template); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicaSetSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_min_ready_seconds, + Key_replicas, + Key_selector, + Key_template, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "minReadySeconds" => Field::Key_min_ready_seconds, + "replicas" => Field::Key_replicas, + "selector" => Field::Key_selector, + "template" => Field::Key_template, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicaSetSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicaSetSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_min_ready_seconds: Option = None; + let mut value_replicas: Option = None; + let mut value_selector: Option = None; + let mut value_template: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_min_ready_seconds => value_min_ready_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicaSetSpec { + min_ready_seconds: value_min_ready_seconds, + replicas: value_replicas, + selector: value_selector.unwrap_or_default(), + template: value_template, + }) + } + } + + deserializer.deserialize_struct( + "ReplicaSetSpec", + &[ + "minReadySeconds", + "replicas", + "selector", + "template", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicaSetSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicaSetSpec", + 1 + + self.min_ready_seconds.as_ref().map_or(0, |_| 1) + + self.replicas.as_ref().map_or(0, |_| 1) + + self.template.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.min_ready_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReadySeconds", value)?; + } + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + if let Some(value) = &self.template { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicaSetSpec { + fn schema_name() -> String { + "io.k8s.api.apps.v1.ReplicaSetSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicaSetSpec is the specification of a ReplicaSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "minReadySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "selector".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/replica_set_status.rs b/src/v1_30/api/apps/v1/replica_set_status.rs new file mode 100644 index 000000000..f247536f7 --- /dev/null +++ b/src/v1_30/api/apps/v1/replica_set_status.rs @@ -0,0 +1,269 @@ +// Generated from definition io.k8s.api.apps.v1.ReplicaSetStatus + +/// ReplicaSetStatus represents the current status of a ReplicaSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicaSetStatus { + /// The number of available replicas (ready for at least minReadySeconds) for this replica set. + pub available_replicas: Option, + + /// Represents the latest available observations of a replica set's current state. + pub conditions: Option>, + + /// The number of pods that have labels matching the labels of the pod template of the replicaset. + pub fully_labeled_replicas: Option, + + /// ObservedGeneration reflects the generation of the most recently observed ReplicaSet. + pub observed_generation: Option, + + /// readyReplicas is the number of pods targeted by this ReplicaSet with a Ready Condition. + pub ready_replicas: Option, + + /// Replicas is the most recently observed number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller + pub replicas: i32, +} + +impl crate::DeepMerge for ReplicaSetStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.available_replicas, other.available_replicas); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.fully_labeled_replicas, other.fully_labeled_replicas); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.ready_replicas, other.ready_replicas); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicaSetStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_available_replicas, + Key_conditions, + Key_fully_labeled_replicas, + Key_observed_generation, + Key_ready_replicas, + Key_replicas, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "availableReplicas" => Field::Key_available_replicas, + "conditions" => Field::Key_conditions, + "fullyLabeledReplicas" => Field::Key_fully_labeled_replicas, + "observedGeneration" => Field::Key_observed_generation, + "readyReplicas" => Field::Key_ready_replicas, + "replicas" => Field::Key_replicas, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicaSetStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicaSetStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_available_replicas: Option = None; + let mut value_conditions: Option> = None; + let mut value_fully_labeled_replicas: Option = None; + let mut value_observed_generation: Option = None; + let mut value_ready_replicas: Option = None; + let mut value_replicas: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_available_replicas => value_available_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fully_labeled_replicas => value_fully_labeled_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready_replicas => value_ready_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicaSetStatus { + available_replicas: value_available_replicas, + conditions: value_conditions, + fully_labeled_replicas: value_fully_labeled_replicas, + observed_generation: value_observed_generation, + ready_replicas: value_ready_replicas, + replicas: value_replicas.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ReplicaSetStatus", + &[ + "availableReplicas", + "conditions", + "fullyLabeledReplicas", + "observedGeneration", + "readyReplicas", + "replicas", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicaSetStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicaSetStatus", + 1 + + self.available_replicas.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.fully_labeled_replicas.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.ready_replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.available_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "availableReplicas", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.fully_labeled_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fullyLabeledReplicas", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.ready_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readyReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", &self.replicas)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicaSetStatus { + fn schema_name() -> String { + "io.k8s.api.apps.v1.ReplicaSetStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicaSetStatus represents the current status of a ReplicaSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "availableReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of available replicas (ready for at least minReadySeconds) for this replica set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a replica set's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "fullyLabeledReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods that have labels matching the labels of the pod template of the replicaset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObservedGeneration reflects the generation of the most recently observed ReplicaSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "readyReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readyReplicas is the number of pods targeted by this ReplicaSet with a Ready Condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Replicas is the most recently observed number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "replicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/rolling_update_daemon_set.rs b/src/v1_30/api/apps/v1/rolling_update_daemon_set.rs new file mode 100644 index 000000000..f520b116f --- /dev/null +++ b/src/v1_30/api/apps/v1/rolling_update_daemon_set.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.RollingUpdateDaemonSet + +/// Spec to control the desired behavior of daemon set rolling update. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RollingUpdateDaemonSet { + /// The maximum number of nodes with an existing available DaemonSet pod that can have an updated DaemonSet pod during during an update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up to a minimum of 1. Default value is 0. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their a new pod created before the old pod is marked as deleted. The update starts by launching new pods on 30% of nodes. Once an updated pod is available (Ready for at least minReadySeconds) the old DaemonSet pod on that node is marked deleted. If the old pod becomes unavailable for any reason (Ready transitions to false, is evicted, or is drained) an updated pod is immediatedly created on that node without considering surge limits. Allowing surge implies the possibility that the resources consumed by the daemonset on any given node can double if the readiness check fails, and so resource intensive daemonsets should take into account that they may cause evictions during disruption. + pub max_surge: Option, + + /// The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0 if MaxSurge is 0 Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update. + pub max_unavailable: Option, +} + +impl crate::DeepMerge for RollingUpdateDaemonSet { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.max_surge, other.max_surge); + crate::DeepMerge::merge_from(&mut self.max_unavailable, other.max_unavailable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RollingUpdateDaemonSet { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_max_surge, + Key_max_unavailable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "maxSurge" => Field::Key_max_surge, + "maxUnavailable" => Field::Key_max_unavailable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RollingUpdateDaemonSet; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RollingUpdateDaemonSet") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_max_surge: Option = None; + let mut value_max_unavailable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_max_surge => value_max_surge = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_unavailable => value_max_unavailable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RollingUpdateDaemonSet { + max_surge: value_max_surge, + max_unavailable: value_max_unavailable, + }) + } + } + + deserializer.deserialize_struct( + "RollingUpdateDaemonSet", + &[ + "maxSurge", + "maxUnavailable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RollingUpdateDaemonSet { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RollingUpdateDaemonSet", + self.max_surge.as_ref().map_or(0, |_| 1) + + self.max_unavailable.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.max_surge { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxSurge", value)?; + } + if let Some(value) = &self.max_unavailable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxUnavailable", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RollingUpdateDaemonSet { + fn schema_name() -> String { + "io.k8s.api.apps.v1.RollingUpdateDaemonSet".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec to control the desired behavior of daemon set rolling update.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "maxSurge".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum number of nodes with an existing available DaemonSet pod that can have an updated DaemonSet pod during during an update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up to a minimum of 1. Default value is 0. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their a new pod created before the old pod is marked as deleted. The update starts by launching new pods on 30% of nodes. Once an updated pod is available (Ready for at least minReadySeconds) the old DaemonSet pod on that node is marked deleted. If the old pod becomes unavailable for any reason (Ready transitions to false, is evicted, or is drained) an updated pod is immediatedly created on that node without considering surge limits. Allowing surge implies the possibility that the resources consumed by the daemonset on any given node can double if the readiness check fails, and so resource intensive daemonsets should take into account that they may cause evictions during disruption.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "maxUnavailable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0 if MaxSurge is 0 Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/rolling_update_deployment.rs b/src/v1_30/api/apps/v1/rolling_update_deployment.rs new file mode 100644 index 000000000..84b6c0480 --- /dev/null +++ b/src/v1_30/api/apps/v1/rolling_update_deployment.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.RollingUpdateDeployment + +/// Spec to control the desired behavior of rolling update. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RollingUpdateDeployment { + /// The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods. + pub max_surge: Option, + + /// The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods. + pub max_unavailable: Option, +} + +impl crate::DeepMerge for RollingUpdateDeployment { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.max_surge, other.max_surge); + crate::DeepMerge::merge_from(&mut self.max_unavailable, other.max_unavailable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RollingUpdateDeployment { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_max_surge, + Key_max_unavailable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "maxSurge" => Field::Key_max_surge, + "maxUnavailable" => Field::Key_max_unavailable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RollingUpdateDeployment; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RollingUpdateDeployment") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_max_surge: Option = None; + let mut value_max_unavailable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_max_surge => value_max_surge = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_unavailable => value_max_unavailable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RollingUpdateDeployment { + max_surge: value_max_surge, + max_unavailable: value_max_unavailable, + }) + } + } + + deserializer.deserialize_struct( + "RollingUpdateDeployment", + &[ + "maxSurge", + "maxUnavailable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RollingUpdateDeployment { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RollingUpdateDeployment", + self.max_surge.as_ref().map_or(0, |_| 1) + + self.max_unavailable.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.max_surge { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxSurge", value)?; + } + if let Some(value) = &self.max_unavailable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxUnavailable", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RollingUpdateDeployment { + fn schema_name() -> String { + "io.k8s.api.apps.v1.RollingUpdateDeployment".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec to control the desired behavior of rolling update.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "maxSurge".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "maxUnavailable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/rolling_update_stateful_set_strategy.rs b/src/v1_30/api/apps/v1/rolling_update_stateful_set_strategy.rs new file mode 100644 index 000000000..a4e0688d0 --- /dev/null +++ b/src/v1_30/api/apps/v1/rolling_update_stateful_set_strategy.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.apps.v1.RollingUpdateStatefulSetStrategy + +/// RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RollingUpdateStatefulSetStrategy { + /// The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable. + pub max_unavailable: Option, + + /// Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0. + pub partition: Option, +} + +impl crate::DeepMerge for RollingUpdateStatefulSetStrategy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.max_unavailable, other.max_unavailable); + crate::DeepMerge::merge_from(&mut self.partition, other.partition); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RollingUpdateStatefulSetStrategy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_max_unavailable, + Key_partition, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "maxUnavailable" => Field::Key_max_unavailable, + "partition" => Field::Key_partition, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RollingUpdateStatefulSetStrategy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RollingUpdateStatefulSetStrategy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_max_unavailable: Option = None; + let mut value_partition: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_max_unavailable => value_max_unavailable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_partition => value_partition = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RollingUpdateStatefulSetStrategy { + max_unavailable: value_max_unavailable, + partition: value_partition, + }) + } + } + + deserializer.deserialize_struct( + "RollingUpdateStatefulSetStrategy", + &[ + "maxUnavailable", + "partition", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RollingUpdateStatefulSetStrategy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RollingUpdateStatefulSetStrategy", + self.max_unavailable.as_ref().map_or(0, |_| 1) + + self.partition.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.max_unavailable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxUnavailable", value)?; + } + if let Some(value) = &self.partition { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "partition", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RollingUpdateStatefulSetStrategy { + fn schema_name() -> String { + "io.k8s.api.apps.v1.RollingUpdateStatefulSetStrategy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "maxUnavailable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "partition".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set.rs b/src/v1_30/api/apps/v1/stateful_set.rs new file mode 100644 index 000000000..d7a358f13 --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set.rs @@ -0,0 +1,249 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSet + +/// StatefulSet represents a set of pods with consistent identities. Identities are defined as: +/// - Network: A single stable DNS and hostname. +/// - Storage: As many VolumeClaims as requested. +/// +/// The StatefulSet guarantees that a given network identity will always map to the same storage identity. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSet { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the desired identities of pods in this set. + pub spec: Option, + + /// Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time. + pub status: Option, +} + +impl crate::Resource for StatefulSet { + const API_VERSION: &'static str = "apps/v1"; + const GROUP: &'static str = "apps"; + const KIND: &'static str = "StatefulSet"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "statefulsets"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for StatefulSet { + const LIST_KIND: &'static str = "StatefulSetList"; +} + +impl crate::Metadata for StatefulSet { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for StatefulSet { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSet { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSet; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSet { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSet { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSet { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSet".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSet represents a set of pods with consistent identities. Identities are defined as:\n - Network: A single stable DNS and hostname.\n - Storage: As many VolumeClaims as requested.\n\nThe StatefulSet guarantees that a given network identity will always map to the same storage identity.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the desired identities of pods in this set.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_condition.rs b/src/v1_30/api/apps/v1/stateful_set_condition.rs new file mode 100644 index 000000000..1463e6a79 --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetCondition + +/// StatefulSetCondition describes the state of a statefulset at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetCondition { + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of statefulset condition. + pub type_: String, +} + +impl crate::DeepMerge for StatefulSetCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetCondition { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSetCondition describes the state of a statefulset at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of statefulset condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_ordinals.rs b/src/v1_30/api/apps/v1/stateful_set_ordinals.rs new file mode 100644 index 000000000..bf4d37ad5 --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_ordinals.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetOrdinals + +/// StatefulSetOrdinals describes the policy used for replica ordinal assignment in this StatefulSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetOrdinals { + /// start is the number representing the first replica's index. It may be used to number replicas from an alternate index (eg: 1-indexed) over the default 0-indexed names, or to orchestrate progressive movement of replicas from one StatefulSet to another. If set, replica indices will be in the range: + /// \[.spec.ordinals.start, .spec.ordinals.start + .spec.replicas). + /// If unset, defaults to 0. Replica indices will be in the range: + /// \[0, .spec.replicas). + pub start: Option, +} + +impl crate::DeepMerge for StatefulSetOrdinals { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.start, other.start); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetOrdinals { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_start, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "start" => Field::Key_start, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetOrdinals; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetOrdinals") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_start: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_start => value_start = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetOrdinals { + start: value_start, + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetOrdinals", + &[ + "start", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetOrdinals { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetOrdinals", + self.start.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.start { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "start", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetOrdinals { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetOrdinals".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSetOrdinals describes the policy used for replica ordinal assignment in this StatefulSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "start".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("start is the number representing the first replica's index. It may be used to number replicas from an alternate index (eg: 1-indexed) over the default 0-indexed names, or to orchestrate progressive movement of replicas from one StatefulSet to another. If set, replica indices will be in the range:\n [.spec.ordinals.start, .spec.ordinals.start + .spec.replicas).\nIf unset, defaults to 0. Replica indices will be in the range:\n [0, .spec.replicas).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_persistent_volume_claim_retention_policy.rs b/src/v1_30/api/apps/v1/stateful_set_persistent_volume_claim_retention_policy.rs new file mode 100644 index 000000000..90c5533d1 --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_persistent_volume_claim_retention_policy.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetPersistentVolumeClaimRetentionPolicy + +/// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetPersistentVolumeClaimRetentionPolicy { + /// WhenDeleted specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is deleted. The default policy of `Retain` causes PVCs to not be affected by StatefulSet deletion. The `Delete` policy causes those PVCs to be deleted. + pub when_deleted: Option, + + /// WhenScaled specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is scaled down. The default policy of `Retain` causes PVCs to not be affected by a scaledown. The `Delete` policy causes the associated PVCs for any excess pods above the replica count to be deleted. + pub when_scaled: Option, +} + +impl crate::DeepMerge for StatefulSetPersistentVolumeClaimRetentionPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.when_deleted, other.when_deleted); + crate::DeepMerge::merge_from(&mut self.when_scaled, other.when_scaled); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetPersistentVolumeClaimRetentionPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_when_deleted, + Key_when_scaled, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "whenDeleted" => Field::Key_when_deleted, + "whenScaled" => Field::Key_when_scaled, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetPersistentVolumeClaimRetentionPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetPersistentVolumeClaimRetentionPolicy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_when_deleted: Option = None; + let mut value_when_scaled: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_when_deleted => value_when_deleted = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_when_scaled => value_when_scaled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetPersistentVolumeClaimRetentionPolicy { + when_deleted: value_when_deleted, + when_scaled: value_when_scaled, + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetPersistentVolumeClaimRetentionPolicy", + &[ + "whenDeleted", + "whenScaled", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetPersistentVolumeClaimRetentionPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetPersistentVolumeClaimRetentionPolicy", + self.when_deleted.as_ref().map_or(0, |_| 1) + + self.when_scaled.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.when_deleted { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "whenDeleted", value)?; + } + if let Some(value) = &self.when_scaled { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "whenScaled", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetPersistentVolumeClaimRetentionPolicy { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetPersistentVolumeClaimRetentionPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "whenDeleted".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WhenDeleted specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is deleted. The default policy of `Retain` causes PVCs to not be affected by StatefulSet deletion. The `Delete` policy causes those PVCs to be deleted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "whenScaled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WhenScaled specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is scaled down. The default policy of `Retain` causes PVCs to not be affected by a scaledown. The `Delete` policy causes the associated PVCs for any excess pods above the replica count to be deleted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_spec.rs b/src/v1_30/api/apps/v1/stateful_set_spec.rs new file mode 100644 index 000000000..5f0a47dfc --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_spec.rs @@ -0,0 +1,381 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetSpec + +/// A StatefulSetSpec is the specification of a StatefulSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetSpec { + /// Minimum number of seconds for which a newly created pod should be ready without any of its container crashing for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready) + pub min_ready_seconds: Option, + + /// ordinals controls the numbering of replica indices in a StatefulSet. The default ordinals behavior assigns a "0" index to the first replica and increments the index by one for each additional replica requested. Using the ordinals field requires the StatefulSetStartOrdinal feature gate to be enabled, which is beta. + pub ordinals: Option, + + /// persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent volume claims created from volumeClaimTemplates. By default, all persistent volume claims are created as needed and retained until manually deleted. This policy allows the lifecycle to be altered, for example by deleting persistent volume claims when their stateful set is deleted, or when their pod is scaled down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. +optional + pub persistent_volume_claim_retention_policy: Option, + + /// podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once. + pub pod_management_policy: Option, + + /// replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1. + pub replicas: Option, + + /// revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10. + pub revision_history_limit: Option, + + /// selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + pub selector: crate::apimachinery::pkg::apis::meta::v1::LabelSelector, + + /// serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where "pod-specific-string" is managed by the StatefulSet controller. + pub service_name: String, + + /// template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. Each pod will be named with the format \-\. For example, a pod in a StatefulSet named "web" with index number "3" would be named "web-3". The only allowed template.spec.restartPolicy value is "Always". + pub template: crate::api::core::v1::PodTemplateSpec, + + /// updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template. + pub update_strategy: Option, + + /// volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name. + pub volume_claim_templates: Option>, +} + +impl crate::DeepMerge for StatefulSetSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.min_ready_seconds, other.min_ready_seconds); + crate::DeepMerge::merge_from(&mut self.ordinals, other.ordinals); + crate::DeepMerge::merge_from(&mut self.persistent_volume_claim_retention_policy, other.persistent_volume_claim_retention_policy); + crate::DeepMerge::merge_from(&mut self.pod_management_policy, other.pod_management_policy); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.revision_history_limit, other.revision_history_limit); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.service_name, other.service_name); + crate::DeepMerge::merge_from(&mut self.template, other.template); + crate::DeepMerge::merge_from(&mut self.update_strategy, other.update_strategy); + crate::merge_strategies::list::atomic(&mut self.volume_claim_templates, other.volume_claim_templates); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_min_ready_seconds, + Key_ordinals, + Key_persistent_volume_claim_retention_policy, + Key_pod_management_policy, + Key_replicas, + Key_revision_history_limit, + Key_selector, + Key_service_name, + Key_template, + Key_update_strategy, + Key_volume_claim_templates, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "minReadySeconds" => Field::Key_min_ready_seconds, + "ordinals" => Field::Key_ordinals, + "persistentVolumeClaimRetentionPolicy" => Field::Key_persistent_volume_claim_retention_policy, + "podManagementPolicy" => Field::Key_pod_management_policy, + "replicas" => Field::Key_replicas, + "revisionHistoryLimit" => Field::Key_revision_history_limit, + "selector" => Field::Key_selector, + "serviceName" => Field::Key_service_name, + "template" => Field::Key_template, + "updateStrategy" => Field::Key_update_strategy, + "volumeClaimTemplates" => Field::Key_volume_claim_templates, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_min_ready_seconds: Option = None; + let mut value_ordinals: Option = None; + let mut value_persistent_volume_claim_retention_policy: Option = None; + let mut value_pod_management_policy: Option = None; + let mut value_replicas: Option = None; + let mut value_revision_history_limit: Option = None; + let mut value_selector: Option = None; + let mut value_service_name: Option = None; + let mut value_template: Option = None; + let mut value_update_strategy: Option = None; + let mut value_volume_claim_templates: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_min_ready_seconds => value_min_ready_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ordinals => value_ordinals = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_persistent_volume_claim_retention_policy => value_persistent_volume_claim_retention_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_management_policy => value_pod_management_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_revision_history_limit => value_revision_history_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_name => value_service_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_update_strategy => value_update_strategy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_claim_templates => value_volume_claim_templates = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetSpec { + min_ready_seconds: value_min_ready_seconds, + ordinals: value_ordinals, + persistent_volume_claim_retention_policy: value_persistent_volume_claim_retention_policy, + pod_management_policy: value_pod_management_policy, + replicas: value_replicas, + revision_history_limit: value_revision_history_limit, + selector: value_selector.unwrap_or_default(), + service_name: value_service_name.unwrap_or_default(), + template: value_template.unwrap_or_default(), + update_strategy: value_update_strategy, + volume_claim_templates: value_volume_claim_templates, + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetSpec", + &[ + "minReadySeconds", + "ordinals", + "persistentVolumeClaimRetentionPolicy", + "podManagementPolicy", + "replicas", + "revisionHistoryLimit", + "selector", + "serviceName", + "template", + "updateStrategy", + "volumeClaimTemplates", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetSpec", + 3 + + self.min_ready_seconds.as_ref().map_or(0, |_| 1) + + self.ordinals.as_ref().map_or(0, |_| 1) + + self.persistent_volume_claim_retention_policy.as_ref().map_or(0, |_| 1) + + self.pod_management_policy.as_ref().map_or(0, |_| 1) + + self.replicas.as_ref().map_or(0, |_| 1) + + self.revision_history_limit.as_ref().map_or(0, |_| 1) + + self.update_strategy.as_ref().map_or(0, |_| 1) + + self.volume_claim_templates.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.min_ready_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReadySeconds", value)?; + } + if let Some(value) = &self.ordinals { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ordinals", value)?; + } + if let Some(value) = &self.persistent_volume_claim_retention_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeClaimRetentionPolicy", value)?; + } + if let Some(value) = &self.pod_management_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podManagementPolicy", value)?; + } + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + if let Some(value) = &self.revision_history_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "revisionHistoryLimit", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceName", &self.service_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?; + if let Some(value) = &self.update_strategy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updateStrategy", value)?; + } + if let Some(value) = &self.volume_claim_templates { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeClaimTemplates", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetSpec { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A StatefulSetSpec is the specification of a StatefulSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "minReadySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum number of seconds for which a newly created pod should be ready without any of its container crashing for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "ordinals".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ordinals controls the numbering of replica indices in a StatefulSet. The default ordinals behavior assigns a \"0\" index to the first replica and increments the index by one for each additional replica requested. Using the ordinals field requires the StatefulSetStartOrdinal feature gate to be enabled, which is beta.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "persistentVolumeClaimRetentionPolicy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent volume claims created from volumeClaimTemplates. By default, all persistent volume claims are created as needed and retained until manually deleted. This policy allows the lifecycle to be altered, for example by deleting persistent volume claims when their stateful set is deleted, or when their pod is scaled down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. +optional".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "podManagementPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "revisionHistoryLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "serviceName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. Each pod will be named with the format -. For example, a pod in a StatefulSet named \"web\" with index number \"3\" would be named \"web-3\". The only allowed template.spec.restartPolicy value is \"Always\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "updateStrategy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeClaimTemplates".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "selector".to_owned(), + "serviceName".to_owned(), + "template".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_status.rs b/src/v1_30/api/apps/v1/stateful_set_status.rs new file mode 100644 index 000000000..5791ca87a --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_status.rs @@ -0,0 +1,371 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetStatus + +/// StatefulSetStatus represents the current state of a StatefulSet. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetStatus { + /// Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset. + pub available_replicas: Option, + + /// collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision. + pub collision_count: Option, + + /// Represents the latest available observations of a statefulset's current state. + pub conditions: Option>, + + /// currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision. + pub current_replicas: Option, + + /// currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence \[0,currentReplicas). + pub current_revision: Option, + + /// observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the StatefulSet's generation, which is updated on mutation by the API Server. + pub observed_generation: Option, + + /// readyReplicas is the number of pods created for this StatefulSet with a Ready Condition. + pub ready_replicas: Option, + + /// replicas is the number of Pods created by the StatefulSet controller. + pub replicas: i32, + + /// updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence \[replicas-updatedReplicas,replicas) + pub update_revision: Option, + + /// updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision. + pub updated_replicas: Option, +} + +impl crate::DeepMerge for StatefulSetStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.available_replicas, other.available_replicas); + crate::DeepMerge::merge_from(&mut self.collision_count, other.collision_count); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.current_replicas, other.current_replicas); + crate::DeepMerge::merge_from(&mut self.current_revision, other.current_revision); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.ready_replicas, other.ready_replicas); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.update_revision, other.update_revision); + crate::DeepMerge::merge_from(&mut self.updated_replicas, other.updated_replicas); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_available_replicas, + Key_collision_count, + Key_conditions, + Key_current_replicas, + Key_current_revision, + Key_observed_generation, + Key_ready_replicas, + Key_replicas, + Key_update_revision, + Key_updated_replicas, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "availableReplicas" => Field::Key_available_replicas, + "collisionCount" => Field::Key_collision_count, + "conditions" => Field::Key_conditions, + "currentReplicas" => Field::Key_current_replicas, + "currentRevision" => Field::Key_current_revision, + "observedGeneration" => Field::Key_observed_generation, + "readyReplicas" => Field::Key_ready_replicas, + "replicas" => Field::Key_replicas, + "updateRevision" => Field::Key_update_revision, + "updatedReplicas" => Field::Key_updated_replicas, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_available_replicas: Option = None; + let mut value_collision_count: Option = None; + let mut value_conditions: Option> = None; + let mut value_current_replicas: Option = None; + let mut value_current_revision: Option = None; + let mut value_observed_generation: Option = None; + let mut value_ready_replicas: Option = None; + let mut value_replicas: Option = None; + let mut value_update_revision: Option = None; + let mut value_updated_replicas: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_available_replicas => value_available_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_collision_count => value_collision_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_replicas => value_current_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_revision => value_current_revision = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready_replicas => value_ready_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_update_revision => value_update_revision = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_updated_replicas => value_updated_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetStatus { + available_replicas: value_available_replicas, + collision_count: value_collision_count, + conditions: value_conditions, + current_replicas: value_current_replicas, + current_revision: value_current_revision, + observed_generation: value_observed_generation, + ready_replicas: value_ready_replicas, + replicas: value_replicas.unwrap_or_default(), + update_revision: value_update_revision, + updated_replicas: value_updated_replicas, + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetStatus", + &[ + "availableReplicas", + "collisionCount", + "conditions", + "currentReplicas", + "currentRevision", + "observedGeneration", + "readyReplicas", + "replicas", + "updateRevision", + "updatedReplicas", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetStatus", + 1 + + self.available_replicas.as_ref().map_or(0, |_| 1) + + self.collision_count.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.current_replicas.as_ref().map_or(0, |_| 1) + + self.current_revision.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.ready_replicas.as_ref().map_or(0, |_| 1) + + self.update_revision.as_ref().map_or(0, |_| 1) + + self.updated_replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.available_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "availableReplicas", value)?; + } + if let Some(value) = &self.collision_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "collisionCount", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.current_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentReplicas", value)?; + } + if let Some(value) = &self.current_revision { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentRevision", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.ready_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readyReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", &self.replicas)?; + if let Some(value) = &self.update_revision { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updateRevision", value)?; + } + if let Some(value) = &self.updated_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "updatedReplicas", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetStatus { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSetStatus represents the current state of a StatefulSet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "availableReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "collisionCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a statefulset's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "currentRevision".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [0,currentReplicas).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the StatefulSet's generation, which is updated on mutation by the API Server.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "readyReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readyReplicas is the number of pods created for this StatefulSet with a Ready Condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("replicas is the number of Pods created by the StatefulSet controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "updateRevision".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [replicas-updatedReplicas,replicas)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "updatedReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "replicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/apps/v1/stateful_set_update_strategy.rs b/src/v1_30/api/apps/v1/stateful_set_update_strategy.rs new file mode 100644 index 000000000..0594b81f7 --- /dev/null +++ b/src/v1_30/api/apps/v1/stateful_set_update_strategy.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.apps.v1.StatefulSetUpdateStrategy + +/// StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatefulSetUpdateStrategy { + /// RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. + pub rolling_update: Option, + + /// Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate. + pub type_: Option, +} + +impl crate::DeepMerge for StatefulSetUpdateStrategy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.rolling_update, other.rolling_update); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatefulSetUpdateStrategy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_rolling_update, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "rollingUpdate" => Field::Key_rolling_update, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatefulSetUpdateStrategy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatefulSetUpdateStrategy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_rolling_update: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_rolling_update => value_rolling_update = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatefulSetUpdateStrategy { + rolling_update: value_rolling_update, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "StatefulSetUpdateStrategy", + &[ + "rollingUpdate", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatefulSetUpdateStrategy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatefulSetUpdateStrategy", + self.rolling_update.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.rolling_update { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rollingUpdate", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatefulSetUpdateStrategy { + fn schema_name() -> String { + "io.k8s.api.apps.v1.StatefulSetUpdateStrategy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "rollingUpdate".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/mod.rs b/src/v1_30/api/authentication/mod.rs new file mode 100644 index 000000000..ab259273f --- /dev/null +++ b/src/v1_30/api/authentication/mod.rs @@ -0,0 +1,5 @@ +pub mod v1; + +pub mod v1alpha1; + +pub mod v1beta1; diff --git a/src/v1_30/api/authentication/v1/bound_object_reference.rs b/src/v1_30/api/authentication/v1/bound_object_reference.rs new file mode 100644 index 000000000..024af1efc --- /dev/null +++ b/src/v1_30/api/authentication/v1/bound_object_reference.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.authentication.v1.BoundObjectReference + +/// BoundObjectReference is a reference to an object that a token is bound to. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct BoundObjectReference { + /// API version of the referent. + pub api_version: Option, + + /// Kind of the referent. Valid kinds are 'Pod' and 'Secret'. + pub kind: Option, + + /// Name of the referent. + pub name: Option, + + /// UID of the referent. + pub uid: Option, +} + +impl crate::DeepMerge for BoundObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for BoundObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_name, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = BoundObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("BoundObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(BoundObjectReference { + api_version: value_api_version, + kind: value_kind, + name: value_name, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "BoundObjectReference", + &[ + "apiVersion", + "kind", + "name", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for BoundObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "BoundObjectReference", + self.api_version.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for BoundObjectReference { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.BoundObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("BoundObjectReference is a reference to an object that a token is bound to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("API version of the referent.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind of the referent. Valid kinds are 'Pod' and 'Secret'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID of the referent.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/mod.rs b/src/v1_30/api/authentication/v1/mod.rs new file mode 100644 index 000000000..6a51261e3 --- /dev/null +++ b/src/v1_30/api/authentication/v1/mod.rs @@ -0,0 +1,30 @@ + +mod bound_object_reference; +pub use self::bound_object_reference::BoundObjectReference; + +mod self_subject_review; +pub use self::self_subject_review::SelfSubjectReview; + +mod self_subject_review_status; +pub use self::self_subject_review_status::SelfSubjectReviewStatus; + +mod token_request; +pub use self::token_request::TokenRequest; + +mod token_request_spec; +pub use self::token_request_spec::TokenRequestSpec; + +mod token_request_status; +pub use self::token_request_status::TokenRequestStatus; + +mod token_review; +pub use self::token_review::TokenReview; + +mod token_review_spec; +pub use self::token_review_spec::TokenReviewSpec; + +mod token_review_status; +pub use self::token_review_status::TokenReviewStatus; + +mod user_info; +pub use self::user_info::UserInfo; diff --git a/src/v1_30/api/authentication/v1/self_subject_review.rs b/src/v1_30/api/authentication/v1/self_subject_review.rs new file mode 100644 index 000000000..e64a7df80 --- /dev/null +++ b/src/v1_30/api/authentication/v1/self_subject_review.rs @@ -0,0 +1,216 @@ +// Generated from definition io.k8s.api.authentication.v1.SelfSubjectReview + +/// SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReview { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Status is filled in by the server with the user attributes. + pub status: Option, +} + +impl crate::Resource for SelfSubjectReview { + const API_VERSION: &'static str = "authentication.k8s.io/v1"; + const GROUP: &'static str = "authentication.k8s.io"; + const KIND: &'static str = "SelfSubjectReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "selfsubjectreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SelfSubjectReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SelfSubjectReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReview { + metadata: value_metadata.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReview { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.SelfSubjectReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server with the user attributes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/self_subject_review_status.rs b/src/v1_30/api/authentication/v1/self_subject_review_status.rs new file mode 100644 index 000000000..e9cf1fe47 --- /dev/null +++ b/src/v1_30/api/authentication/v1/self_subject_review_status.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.authentication.v1.SelfSubjectReviewStatus + +/// SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReviewStatus { + /// User attributes of the user making this request. + pub user_info: Option, +} + +impl crate::DeepMerge for SelfSubjectReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.user_info, other.user_info); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_user_info, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "userInfo" => Field::Key_user_info, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelfSubjectReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_user_info: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_user_info => value_user_info = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReviewStatus { + user_info: value_user_info, + }) + } + } + + deserializer.deserialize_struct( + "SelfSubjectReviewStatus", + &[ + "userInfo", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelfSubjectReviewStatus", + self.user_info.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.user_info { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "userInfo", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.SelfSubjectReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "userInfo".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User attributes of the user making this request.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_request.rs b/src/v1_30/api/authentication/v1/token_request.rs new file mode 100644 index 000000000..1e7bde4f7 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_request.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenRequest + +/// TokenRequest requests a token for a given service account. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenRequest { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated + pub spec: crate::api::authentication::v1::TokenRequestSpec, + + /// Status is filled in by the server and indicates whether the token can be authenticated. + pub status: Option, +} + +impl crate::Resource for TokenRequest { + const API_VERSION: &'static str = "authentication.k8s.io/v1"; + const GROUP: &'static str = "authentication.k8s.io"; + const KIND: &'static str = "TokenRequest"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "token"; + type Scope = crate::SubResourceScope; +} + +impl crate::Metadata for TokenRequest { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for TokenRequest { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenRequest { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenRequest; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenRequest { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenRequest { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenRequest { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenRequest".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenRequest requests a token for a given service account.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates whether the token can be authenticated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_request_spec.rs b/src/v1_30/api/authentication/v1/token_request_spec.rs new file mode 100644 index 000000000..6f784dff5 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_request_spec.rs @@ -0,0 +1,188 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenRequestSpec + +/// TokenRequestSpec contains client provided parameters of a token request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenRequestSpec { + /// Audiences are the intendend audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences. + pub audiences: Vec, + + /// BoundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation. + pub bound_object_ref: Option, + + /// ExpirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response. + pub expiration_seconds: Option, +} + +impl crate::DeepMerge for TokenRequestSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audiences, other.audiences); + crate::DeepMerge::merge_from(&mut self.bound_object_ref, other.bound_object_ref); + crate::DeepMerge::merge_from(&mut self.expiration_seconds, other.expiration_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenRequestSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audiences, + Key_bound_object_ref, + Key_expiration_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "audiences" => Field::Key_audiences, + "boundObjectRef" => Field::Key_bound_object_ref, + "expirationSeconds" => Field::Key_expiration_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenRequestSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TokenRequestSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audiences: Option> = None; + let mut value_bound_object_ref: Option = None; + let mut value_expiration_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audiences => value_audiences = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_bound_object_ref => value_bound_object_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_expiration_seconds => value_expiration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenRequestSpec { + audiences: value_audiences.unwrap_or_default(), + bound_object_ref: value_bound_object_ref, + expiration_seconds: value_expiration_seconds, + }) + } + } + + deserializer.deserialize_struct( + "TokenRequestSpec", + &[ + "audiences", + "boundObjectRef", + "expirationSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenRequestSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TokenRequestSpec", + 1 + + self.bound_object_ref.as_ref().map_or(0, |_| 1) + + self.expiration_seconds.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "audiences", &self.audiences)?; + if let Some(value) = &self.bound_object_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "boundObjectRef", value)?; + } + if let Some(value) = &self.expiration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expirationSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenRequestSpec { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenRequestSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenRequestSpec contains client provided parameters of a token request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "audiences".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Audiences are the intendend audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "boundObjectRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("BoundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "expirationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExpirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "audiences".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_request_status.rs b/src/v1_30/api/authentication/v1/token_request_status.rs new file mode 100644 index 000000000..8e2f15a50 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_request_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenRequestStatus + +/// TokenRequestStatus is the result of a token request. +#[derive(Clone, Debug, PartialEq)] +pub struct TokenRequestStatus { + /// ExpirationTimestamp is the time of expiration of the returned token. + pub expiration_timestamp: crate::apimachinery::pkg::apis::meta::v1::Time, + + /// Token is the opaque bearer token. + pub token: String, +} + +impl crate::DeepMerge for TokenRequestStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expiration_timestamp, other.expiration_timestamp); + crate::DeepMerge::merge_from(&mut self.token, other.token); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenRequestStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expiration_timestamp, + Key_token, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expirationTimestamp" => Field::Key_expiration_timestamp, + "token" => Field::Key_token, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenRequestStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TokenRequestStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expiration_timestamp: Option = None; + let mut value_token: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expiration_timestamp => value_expiration_timestamp = Some(crate::serde::de::MapAccess::next_value(&mut map)?), + Field::Key_token => value_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenRequestStatus { + expiration_timestamp: value_expiration_timestamp.ok_or_else(|| crate::serde::de::Error::missing_field("expirationTimestamp"))?, + token: value_token.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "TokenRequestStatus", + &[ + "expirationTimestamp", + "token", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenRequestStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TokenRequestStatus", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expirationTimestamp", &self.expiration_timestamp)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "token", &self.token)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenRequestStatus { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenRequestStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenRequestStatus is the result of a token request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expirationTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExpirationTimestamp is the time of expiration of the returned token.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "token".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Token is the opaque bearer token.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "expirationTimestamp".to_owned(), + "token".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_review.rs b/src/v1_30/api/authentication/v1/token_review.rs new file mode 100644 index 000000000..cfe4c90a4 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_review.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenReview + +/// TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenReview { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated + pub spec: crate::api::authentication::v1::TokenReviewSpec, + + /// Status is filled in by the server and indicates whether the request can be authenticated. + pub status: Option, +} + +impl crate::Resource for TokenReview { + const API_VERSION: &'static str = "authentication.k8s.io/v1"; + const GROUP: &'static str = "authentication.k8s.io"; + const KIND: &'static str = "TokenReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "tokenreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for TokenReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for TokenReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenReview { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenReview { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates whether the request can be authenticated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_review_spec.rs b/src/v1_30/api/authentication/v1/token_review_spec.rs new file mode 100644 index 000000000..281127b67 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_review_spec.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenReviewSpec + +/// TokenReviewSpec is a description of the token authentication request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenReviewSpec { + /// Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver. + pub audiences: Option>, + + /// Token is the opaque bearer token. + pub token: Option, +} + +impl crate::DeepMerge for TokenReviewSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audiences, other.audiences); + crate::DeepMerge::merge_from(&mut self.token, other.token); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenReviewSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audiences, + Key_token, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "audiences" => Field::Key_audiences, + "token" => Field::Key_token, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenReviewSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TokenReviewSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audiences: Option> = None; + let mut value_token: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audiences => value_audiences = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_token => value_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenReviewSpec { + audiences: value_audiences, + token: value_token, + }) + } + } + + deserializer.deserialize_struct( + "TokenReviewSpec", + &[ + "audiences", + "token", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenReviewSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TokenReviewSpec", + self.audiences.as_ref().map_or(0, |_| 1) + + self.token.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audiences { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "audiences", value)?; + } + if let Some(value) = &self.token { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "token", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenReviewSpec { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenReviewSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenReviewSpec is a description of the token authentication request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "audiences".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "token".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Token is the opaque bearer token.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/token_review_status.rs b/src/v1_30/api/authentication/v1/token_review_status.rs new file mode 100644 index 000000000..4dd5aacc3 --- /dev/null +++ b/src/v1_30/api/authentication/v1/token_review_status.rs @@ -0,0 +1,211 @@ +// Generated from definition io.k8s.api.authentication.v1.TokenReviewStatus + +/// TokenReviewStatus is the result of the token authentication request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenReviewStatus { + /// Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is "true", the token is valid against the audience of the Kubernetes API server. + pub audiences: Option>, + + /// Authenticated indicates that the token was associated with a known user. + pub authenticated: Option, + + /// Error indicates that the token couldn't be checked + pub error: Option, + + /// User is the UserInfo associated with the provided token. + pub user: Option, +} + +impl crate::DeepMerge for TokenReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.audiences, other.audiences); + crate::DeepMerge::merge_from(&mut self.authenticated, other.authenticated); + crate::DeepMerge::merge_from(&mut self.error, other.error); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audiences, + Key_authenticated, + Key_error, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "audiences" => Field::Key_audiences, + "authenticated" => Field::Key_authenticated, + "error" => Field::Key_error, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TokenReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audiences: Option> = None; + let mut value_authenticated: Option = None; + let mut value_error: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audiences => value_audiences = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_authenticated => value_authenticated = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_error => value_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenReviewStatus { + audiences: value_audiences, + authenticated: value_authenticated, + error: value_error, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "TokenReviewStatus", + &[ + "audiences", + "authenticated", + "error", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TokenReviewStatus", + self.audiences.as_ref().map_or(0, |_| 1) + + self.authenticated.as_ref().map_or(0, |_| 1) + + self.error.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audiences { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "audiences", value)?; + } + if let Some(value) = &self.authenticated { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "authenticated", value)?; + } + if let Some(value) = &self.error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "error", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.TokenReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenReviewStatus is the result of the token authentication request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "audiences".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "authenticated".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Authenticated indicates that the token was associated with a known user.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "error".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Error indicates that the token couldn't be checked".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "user".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User is the UserInfo associated with the provided token.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1/user_info.rs b/src/v1_30/api/authentication/v1/user_info.rs new file mode 100644 index 000000000..3890788cd --- /dev/null +++ b/src/v1_30/api/authentication/v1/user_info.rs @@ -0,0 +1,231 @@ +// Generated from definition io.k8s.api.authentication.v1.UserInfo + +/// UserInfo holds the information about the user needed to implement the user.Info interface. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct UserInfo { + /// Any additional information provided by the authenticator. + pub extra: Option>>, + + /// The names of groups this user is a part of. + pub groups: Option>, + + /// A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs. + pub uid: Option, + + /// The name that uniquely identifies this user among all active users. + pub username: Option, +} + +impl crate::DeepMerge for UserInfo { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.extra, other.extra, |current_item, other_item| { + crate::merge_strategies::list::atomic(current_item, other_item); + }); + crate::merge_strategies::list::atomic(&mut self.groups, other.groups); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + crate::DeepMerge::merge_from(&mut self.username, other.username); + } +} + +impl<'de> crate::serde::Deserialize<'de> for UserInfo { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_extra, + Key_groups, + Key_uid, + Key_username, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "extra" => Field::Key_extra, + "groups" => Field::Key_groups, + "uid" => Field::Key_uid, + "username" => Field::Key_username, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = UserInfo; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("UserInfo") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_extra: Option>> = None; + let mut value_groups: Option> = None; + let mut value_uid: Option = None; + let mut value_username: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_extra => value_extra = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_groups => value_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_username => value_username = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(UserInfo { + extra: value_extra, + groups: value_groups, + uid: value_uid, + username: value_username, + }) + } + } + + deserializer.deserialize_struct( + "UserInfo", + &[ + "extra", + "groups", + "uid", + "username", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for UserInfo { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "UserInfo", + self.extra.as_ref().map_or(0, |_| 1) + + self.groups.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1) + + self.username.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.extra { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "extra", value)?; + } + if let Some(value) = &self.groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groups", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + if let Some(value) = &self.username { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "username", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for UserInfo { + fn schema_name() -> String { + "io.k8s.api.authentication.v1.UserInfo".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UserInfo holds the information about the user needed to implement the user.Info interface.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "extra".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Any additional information provided by the authenticator.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "groups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The names of groups this user is a part of.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "username".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name that uniquely identifies this user among all active users.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1alpha1/mod.rs b/src/v1_30/api/authentication/v1alpha1/mod.rs new file mode 100644 index 000000000..c77460f75 --- /dev/null +++ b/src/v1_30/api/authentication/v1alpha1/mod.rs @@ -0,0 +1,6 @@ + +mod self_subject_review; +pub use self::self_subject_review::SelfSubjectReview; + +mod self_subject_review_status; +pub use self::self_subject_review_status::SelfSubjectReviewStatus; diff --git a/src/v1_30/api/authentication/v1alpha1/self_subject_review.rs b/src/v1_30/api/authentication/v1alpha1/self_subject_review.rs new file mode 100644 index 000000000..1f41b04f5 --- /dev/null +++ b/src/v1_30/api/authentication/v1alpha1/self_subject_review.rs @@ -0,0 +1,216 @@ +// Generated from definition io.k8s.api.authentication.v1alpha1.SelfSubjectReview + +/// SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReview { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Status is filled in by the server with the user attributes. + pub status: Option, +} + +impl crate::Resource for SelfSubjectReview { + const API_VERSION: &'static str = "authentication.k8s.io/v1alpha1"; + const GROUP: &'static str = "authentication.k8s.io"; + const KIND: &'static str = "SelfSubjectReview"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "selfsubjectreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SelfSubjectReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SelfSubjectReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReview { + metadata: value_metadata.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReview { + fn schema_name() -> String { + "io.k8s.api.authentication.v1alpha1.SelfSubjectReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server with the user attributes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1alpha1/self_subject_review_status.rs b/src/v1_30/api/authentication/v1alpha1/self_subject_review_status.rs new file mode 100644 index 000000000..fec5461a4 --- /dev/null +++ b/src/v1_30/api/authentication/v1alpha1/self_subject_review_status.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.authentication.v1alpha1.SelfSubjectReviewStatus + +/// SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReviewStatus { + /// User attributes of the user making this request. + pub user_info: Option, +} + +impl crate::DeepMerge for SelfSubjectReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.user_info, other.user_info); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_user_info, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "userInfo" => Field::Key_user_info, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelfSubjectReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_user_info: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_user_info => value_user_info = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReviewStatus { + user_info: value_user_info, + }) + } + } + + deserializer.deserialize_struct( + "SelfSubjectReviewStatus", + &[ + "userInfo", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelfSubjectReviewStatus", + self.user_info.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.user_info { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "userInfo", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authentication.v1alpha1.SelfSubjectReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "userInfo".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User attributes of the user making this request.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1beta1/mod.rs b/src/v1_30/api/authentication/v1beta1/mod.rs new file mode 100644 index 000000000..c77460f75 --- /dev/null +++ b/src/v1_30/api/authentication/v1beta1/mod.rs @@ -0,0 +1,6 @@ + +mod self_subject_review; +pub use self::self_subject_review::SelfSubjectReview; + +mod self_subject_review_status; +pub use self::self_subject_review_status::SelfSubjectReviewStatus; diff --git a/src/v1_30/api/authentication/v1beta1/self_subject_review.rs b/src/v1_30/api/authentication/v1beta1/self_subject_review.rs new file mode 100644 index 000000000..b9ec965a5 --- /dev/null +++ b/src/v1_30/api/authentication/v1beta1/self_subject_review.rs @@ -0,0 +1,216 @@ +// Generated from definition io.k8s.api.authentication.v1beta1.SelfSubjectReview + +/// SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReview { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Status is filled in by the server with the user attributes. + pub status: Option, +} + +impl crate::Resource for SelfSubjectReview { + const API_VERSION: &'static str = "authentication.k8s.io/v1beta1"; + const GROUP: &'static str = "authentication.k8s.io"; + const KIND: &'static str = "SelfSubjectReview"; + const VERSION: &'static str = "v1beta1"; + const URL_PATH_SEGMENT: &'static str = "selfsubjectreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SelfSubjectReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SelfSubjectReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReview { + metadata: value_metadata.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReview { + fn schema_name() -> String { + "io.k8s.api.authentication.v1beta1.SelfSubjectReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server with the user attributes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authentication/v1beta1/self_subject_review_status.rs b/src/v1_30/api/authentication/v1beta1/self_subject_review_status.rs new file mode 100644 index 000000000..24bde18e2 --- /dev/null +++ b/src/v1_30/api/authentication/v1beta1/self_subject_review_status.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.authentication.v1beta1.SelfSubjectReviewStatus + +/// SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectReviewStatus { + /// User attributes of the user making this request. + pub user_info: Option, +} + +impl crate::DeepMerge for SelfSubjectReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.user_info, other.user_info); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_user_info, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "userInfo" => Field::Key_user_info, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelfSubjectReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_user_info: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_user_info => value_user_info = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectReviewStatus { + user_info: value_user_info, + }) + } + } + + deserializer.deserialize_struct( + "SelfSubjectReviewStatus", + &[ + "userInfo", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelfSubjectReviewStatus", + self.user_info.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.user_info { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "userInfo", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authentication.v1beta1.SelfSubjectReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "userInfo".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User attributes of the user making this request.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/mod.rs b/src/v1_30/api/authorization/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/authorization/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/authorization/v1/local_subject_access_review.rs b/src/v1_30/api/authorization/v1/local_subject_access_review.rs new file mode 100644 index 000000000..8c7fcfb43 --- /dev/null +++ b/src/v1_30/api/authorization/v1/local_subject_access_review.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authorization.v1.LocalSubjectAccessReview + +/// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LocalSubjectAccessReview { + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted. + pub spec: crate::api::authorization::v1::SubjectAccessReviewSpec, + + /// Status is filled in by the server and indicates whether the request is allowed or not + pub status: Option, +} + +impl crate::Resource for LocalSubjectAccessReview { + const API_VERSION: &'static str = "authorization.k8s.io/v1"; + const GROUP: &'static str = "authorization.k8s.io"; + const KIND: &'static str = "LocalSubjectAccessReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "localsubjectaccessreviews"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::Metadata for LocalSubjectAccessReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for LocalSubjectAccessReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LocalSubjectAccessReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LocalSubjectAccessReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LocalSubjectAccessReview { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LocalSubjectAccessReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LocalSubjectAccessReview { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.LocalSubjectAccessReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates whether the request is allowed or not".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/mod.rs b/src/v1_30/api/authorization/v1/mod.rs new file mode 100644 index 000000000..ee4f9cc0f --- /dev/null +++ b/src/v1_30/api/authorization/v1/mod.rs @@ -0,0 +1,39 @@ + +mod local_subject_access_review; +pub use self::local_subject_access_review::LocalSubjectAccessReview; + +mod non_resource_attributes; +pub use self::non_resource_attributes::NonResourceAttributes; + +mod non_resource_rule; +pub use self::non_resource_rule::NonResourceRule; + +mod resource_attributes; +pub use self::resource_attributes::ResourceAttributes; + +mod resource_rule; +pub use self::resource_rule::ResourceRule; + +mod self_subject_access_review; +pub use self::self_subject_access_review::SelfSubjectAccessReview; + +mod self_subject_access_review_spec; +pub use self::self_subject_access_review_spec::SelfSubjectAccessReviewSpec; + +mod self_subject_rules_review; +pub use self::self_subject_rules_review::SelfSubjectRulesReview; + +mod self_subject_rules_review_spec; +pub use self::self_subject_rules_review_spec::SelfSubjectRulesReviewSpec; + +mod subject_access_review; +pub use self::subject_access_review::SubjectAccessReview; + +mod subject_access_review_spec; +pub use self::subject_access_review_spec::SubjectAccessReviewSpec; + +mod subject_access_review_status; +pub use self::subject_access_review_status::SubjectAccessReviewStatus; + +mod subject_rules_review_status; +pub use self::subject_rules_review_status::SubjectRulesReviewStatus; diff --git a/src/v1_30/api/authorization/v1/non_resource_attributes.rs b/src/v1_30/api/authorization/v1/non_resource_attributes.rs new file mode 100644 index 000000000..4a4a284d7 --- /dev/null +++ b/src/v1_30/api/authorization/v1/non_resource_attributes.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.authorization.v1.NonResourceAttributes + +/// NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NonResourceAttributes { + /// Path is the URL path of the request + pub path: Option, + + /// Verb is the standard HTTP verb + pub verb: Option, +} + +impl crate::DeepMerge for NonResourceAttributes { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.verb, other.verb); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NonResourceAttributes { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_path, + Key_verb, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "path" => Field::Key_path, + "verb" => Field::Key_verb, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NonResourceAttributes; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NonResourceAttributes") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_path: Option = None; + let mut value_verb: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verb => value_verb = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NonResourceAttributes { + path: value_path, + verb: value_verb, + }) + } + } + + deserializer.deserialize_struct( + "NonResourceAttributes", + &[ + "path", + "verb", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NonResourceAttributes { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NonResourceAttributes", + self.path.as_ref().map_or(0, |_| 1) + + self.verb.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + if let Some(value) = &self.verb { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verb", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NonResourceAttributes { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.NonResourceAttributes".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Path is the URL path of the request".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "verb".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Verb is the standard HTTP verb".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/non_resource_rule.rs b/src/v1_30/api/authorization/v1/non_resource_rule.rs new file mode 100644 index 000000000..db780454b --- /dev/null +++ b/src/v1_30/api/authorization/v1/non_resource_rule.rs @@ -0,0 +1,171 @@ +// Generated from definition io.k8s.api.authorization.v1.NonResourceRule + +/// NonResourceRule holds information that describes a rule for the non-resource +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NonResourceRule { + /// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. "*" means all. + pub non_resource_urls: Option>, + + /// Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + pub verbs: Vec, +} + +impl crate::DeepMerge for NonResourceRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.non_resource_urls, other.non_resource_urls); + crate::merge_strategies::list::atomic(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NonResourceRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_urls, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceURLs" => Field::Key_non_resource_urls, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NonResourceRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NonResourceRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_urls: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_urls => value_non_resource_urls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NonResourceRule { + non_resource_urls: value_non_resource_urls, + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NonResourceRule", + &[ + "nonResourceURLs", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NonResourceRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NonResourceRule", + 1 + + self.non_resource_urls.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.non_resource_urls { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceURLs", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NonResourceRule { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.NonResourceRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceRule holds information that describes a rule for the non-resource".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceURLs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/resource_attributes.rs b/src/v1_30/api/authorization/v1/resource_attributes.rs new file mode 100644 index 000000000..42bd58da4 --- /dev/null +++ b/src/v1_30/api/authorization/v1/resource_attributes.rs @@ -0,0 +1,277 @@ +// Generated from definition io.k8s.api.authorization.v1.ResourceAttributes + +/// ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceAttributes { + /// Group is the API Group of the Resource. "*" means all. + pub group: Option, + + /// Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + pub name: Option, + + /// Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces "" (empty) is defaulted for LocalSubjectAccessReviews "" (empty) is empty for cluster-scoped resources "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview + pub namespace: Option, + + /// Resource is one of the existing resource types. "*" means all. + pub resource: Option, + + /// Subresource is one of the existing resource types. "" means none. + pub subresource: Option, + + /// Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + pub verb: Option, + + /// Version is the API Version of the Resource. "*" means all. + pub version: Option, +} + +impl crate::DeepMerge for ResourceAttributes { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.subresource, other.subresource); + crate::DeepMerge::merge_from(&mut self.verb, other.verb); + crate::DeepMerge::merge_from(&mut self.version, other.version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceAttributes { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_name, + Key_namespace, + Key_resource, + Key_subresource, + Key_verb, + Key_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "resource" => Field::Key_resource, + "subresource" => Field::Key_subresource, + "verb" => Field::Key_verb, + "version" => Field::Key_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceAttributes; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceAttributes") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_resource: Option = None; + let mut value_subresource: Option = None; + let mut value_verb: Option = None; + let mut value_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subresource => value_subresource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verb => value_verb = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceAttributes { + group: value_group, + name: value_name, + namespace: value_namespace, + resource: value_resource, + subresource: value_subresource, + verb: value_verb, + version: value_version, + }) + } + } + + deserializer.deserialize_struct( + "ResourceAttributes", + &[ + "group", + "name", + "namespace", + "resource", + "subresource", + "verb", + "version", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceAttributes { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceAttributes", + self.group.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.resource.as_ref().map_or(0, |_| 1) + + self.subresource.as_ref().map_or(0, |_| 1) + + self.verb.as_ref().map_or(0, |_| 1) + + self.version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", value)?; + } + if let Some(value) = &self.subresource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subresource", value)?; + } + if let Some(value) = &self.verb { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verb", value)?; + } + if let Some(value) = &self.version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceAttributes { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.ResourceAttributes".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Group is the API Group of the Resource. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resource is one of the existing resource types. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "subresource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subresource is one of the existing resource types. \"\" means none.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "verb".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Version is the API Version of the Resource. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/resource_rule.rs b/src/v1_30/api/authorization/v1/resource_rule.rs new file mode 100644 index 000000000..1af933365 --- /dev/null +++ b/src/v1_30/api/authorization/v1/resource_rule.rs @@ -0,0 +1,240 @@ +// Generated from definition io.k8s.api.authorization.v1.ResourceRule + +/// ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceRule { + /// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "*" means all. + pub api_groups: Option>, + + /// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + pub resource_names: Option>, + + /// Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + /// "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. + pub resources: Option>, + + /// Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + pub verbs: Vec, +} + +impl crate::DeepMerge for ResourceRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.resource_names, other.resource_names); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::merge_strategies::list::atomic(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_resource_names, + Key_resources, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "resourceNames" => Field::Key_resource_names, + "resources" => Field::Key_resources, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_resource_names: Option> = None; + let mut value_resources: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_names => value_resource_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceRule { + api_groups: value_api_groups, + resource_names: value_resource_names, + resources: value_resources, + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceRule", + &[ + "apiGroups", + "resourceNames", + "resources", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceRule", + 1 + + self.api_groups.as_ref().map_or(0, |_| 1) + + self.resource_names.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.resource_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceNames", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceRule { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.ResourceRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to. \"*\" means all in the specified apiGroups.\n \"*/foo\" represents the subresource 'foo' for all resources in the specified apiGroups.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/self_subject_access_review.rs b/src/v1_30/api/authorization/v1/self_subject_access_review.rs new file mode 100644 index 000000000..b1a2b7c2d --- /dev/null +++ b/src/v1_30/api/authorization/v1/self_subject_access_review.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authorization.v1.SelfSubjectAccessReview + +/// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perform an action +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectAccessReview { + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated. user and groups must be empty + pub spec: crate::api::authorization::v1::SelfSubjectAccessReviewSpec, + + /// Status is filled in by the server and indicates whether the request is allowed or not + pub status: Option, +} + +impl crate::Resource for SelfSubjectAccessReview { + const API_VERSION: &'static str = "authorization.k8s.io/v1"; + const GROUP: &'static str = "authorization.k8s.io"; + const KIND: &'static str = "SelfSubjectAccessReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "selfsubjectaccessreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SelfSubjectAccessReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SelfSubjectAccessReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectAccessReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectAccessReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectAccessReview { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectAccessReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectAccessReview { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SelfSubjectAccessReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated. user and groups must be empty".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates whether the request is allowed or not".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/self_subject_access_review_spec.rs b/src/v1_30/api/authorization/v1/self_subject_access_review_spec.rs new file mode 100644 index 000000000..dab5aba82 --- /dev/null +++ b/src/v1_30/api/authorization/v1/self_subject_access_review_spec.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.authorization.v1.SelfSubjectAccessReviewSpec + +/// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectAccessReviewSpec { + /// NonResourceAttributes describes information for a non-resource access request + pub non_resource_attributes: Option, + + /// ResourceAuthorizationAttributes describes information for a resource access request + pub resource_attributes: Option, +} + +impl crate::DeepMerge for SelfSubjectAccessReviewSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.non_resource_attributes, other.non_resource_attributes); + crate::DeepMerge::merge_from(&mut self.resource_attributes, other.resource_attributes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectAccessReviewSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_attributes, + Key_resource_attributes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceAttributes" => Field::Key_non_resource_attributes, + "resourceAttributes" => Field::Key_resource_attributes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectAccessReviewSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelfSubjectAccessReviewSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_attributes: Option = None; + let mut value_resource_attributes: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_attributes => value_non_resource_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_attributes => value_resource_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectAccessReviewSpec { + non_resource_attributes: value_non_resource_attributes, + resource_attributes: value_resource_attributes, + }) + } + } + + deserializer.deserialize_struct( + "SelfSubjectAccessReviewSpec", + &[ + "nonResourceAttributes", + "resourceAttributes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectAccessReviewSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelfSubjectAccessReviewSpec", + self.non_resource_attributes.as_ref().map_or(0, |_| 1) + + self.resource_attributes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.non_resource_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceAttributes", value)?; + } + if let Some(value) = &self.resource_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceAttributes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectAccessReviewSpec { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SelfSubjectAccessReviewSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceAttributes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceAttributes describes information for a non-resource access request".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceAttributes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceAuthorizationAttributes describes information for a resource access request".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/self_subject_rules_review.rs b/src/v1_30/api/authorization/v1/self_subject_rules_review.rs new file mode 100644 index 000000000..1a821f5ae --- /dev/null +++ b/src/v1_30/api/authorization/v1/self_subject_rules_review.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authorization.v1.SelfSubjectRulesReview + +/// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectRulesReview { + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated. + pub spec: crate::api::authorization::v1::SelfSubjectRulesReviewSpec, + + /// Status is filled in by the server and indicates the set of actions a user can perform. + pub status: Option, +} + +impl crate::Resource for SelfSubjectRulesReview { + const API_VERSION: &'static str = "authorization.k8s.io/v1"; + const GROUP: &'static str = "authorization.k8s.io"; + const KIND: &'static str = "SelfSubjectRulesReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "selfsubjectrulesreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SelfSubjectRulesReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SelfSubjectRulesReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectRulesReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectRulesReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectRulesReview { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectRulesReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectRulesReview { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SelfSubjectRulesReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates the set of actions a user can perform.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/self_subject_rules_review_spec.rs b/src/v1_30/api/authorization/v1/self_subject_rules_review_spec.rs new file mode 100644 index 000000000..087406a4f --- /dev/null +++ b/src/v1_30/api/authorization/v1/self_subject_rules_review_spec.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.authorization.v1.SelfSubjectRulesReviewSpec + +/// SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelfSubjectRulesReviewSpec { + /// Namespace to evaluate rules for. Required. + pub namespace: Option, +} + +impl crate::DeepMerge for SelfSubjectRulesReviewSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelfSubjectRulesReviewSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelfSubjectRulesReviewSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelfSubjectRulesReviewSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelfSubjectRulesReviewSpec { + namespace: value_namespace, + }) + } + } + + deserializer.deserialize_struct( + "SelfSubjectRulesReviewSpec", + &[ + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelfSubjectRulesReviewSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelfSubjectRulesReviewSpec", + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelfSubjectRulesReviewSpec { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SelfSubjectRulesReviewSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace to evaluate rules for. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/subject_access_review.rs b/src/v1_30/api/authorization/v1/subject_access_review.rs new file mode 100644 index 000000000..6fa3434c2 --- /dev/null +++ b/src/v1_30/api/authorization/v1/subject_access_review.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.authorization.v1.SubjectAccessReview + +/// SubjectAccessReview checks whether or not a user or group can perform an action. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SubjectAccessReview { + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec holds information about the request being evaluated + pub spec: crate::api::authorization::v1::SubjectAccessReviewSpec, + + /// Status is filled in by the server and indicates whether the request is allowed or not + pub status: Option, +} + +impl crate::Resource for SubjectAccessReview { + const API_VERSION: &'static str = "authorization.k8s.io/v1"; + const GROUP: &'static str = "authorization.k8s.io"; + const KIND: &'static str = "SubjectAccessReview"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "subjectaccessreviews"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::Metadata for SubjectAccessReview { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for SubjectAccessReview { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SubjectAccessReview { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SubjectAccessReview; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SubjectAccessReview { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SubjectAccessReview { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SubjectAccessReview { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SubjectAccessReview".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SubjectAccessReview checks whether or not a user or group can perform an action.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec holds information about the request being evaluated".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is filled in by the server and indicates whether the request is allowed or not".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/subject_access_review_spec.rs b/src/v1_30/api/authorization/v1/subject_access_review_spec.rs new file mode 100644 index 000000000..a4c4af18c --- /dev/null +++ b/src/v1_30/api/authorization/v1/subject_access_review_spec.rs @@ -0,0 +1,281 @@ +// Generated from definition io.k8s.api.authorization.v1.SubjectAccessReviewSpec + +/// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SubjectAccessReviewSpec { + /// Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here. + pub extra: Option>>, + + /// Groups is the groups you're testing for. + pub groups: Option>, + + /// NonResourceAttributes describes information for a non-resource access request + pub non_resource_attributes: Option, + + /// ResourceAuthorizationAttributes describes information for a resource access request + pub resource_attributes: Option, + + /// UID information about the requesting user. + pub uid: Option, + + /// User is the user you're testing for. If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups + pub user: Option, +} + +impl crate::DeepMerge for SubjectAccessReviewSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.extra, other.extra, |current_item, other_item| { + crate::merge_strategies::list::atomic(current_item, other_item); + }); + crate::merge_strategies::list::atomic(&mut self.groups, other.groups); + crate::DeepMerge::merge_from(&mut self.non_resource_attributes, other.non_resource_attributes); + crate::DeepMerge::merge_from(&mut self.resource_attributes, other.resource_attributes); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SubjectAccessReviewSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_extra, + Key_groups, + Key_non_resource_attributes, + Key_resource_attributes, + Key_uid, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "extra" => Field::Key_extra, + "groups" => Field::Key_groups, + "nonResourceAttributes" => Field::Key_non_resource_attributes, + "resourceAttributes" => Field::Key_resource_attributes, + "uid" => Field::Key_uid, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SubjectAccessReviewSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SubjectAccessReviewSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_extra: Option>> = None; + let mut value_groups: Option> = None; + let mut value_non_resource_attributes: Option = None; + let mut value_resource_attributes: Option = None; + let mut value_uid: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_extra => value_extra = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_groups => value_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_non_resource_attributes => value_non_resource_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_attributes => value_resource_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SubjectAccessReviewSpec { + extra: value_extra, + groups: value_groups, + non_resource_attributes: value_non_resource_attributes, + resource_attributes: value_resource_attributes, + uid: value_uid, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "SubjectAccessReviewSpec", + &[ + "extra", + "groups", + "nonResourceAttributes", + "resourceAttributes", + "uid", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SubjectAccessReviewSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SubjectAccessReviewSpec", + self.extra.as_ref().map_or(0, |_| 1) + + self.groups.as_ref().map_or(0, |_| 1) + + self.non_resource_attributes.as_ref().map_or(0, |_| 1) + + self.resource_attributes.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.extra { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "extra", value)?; + } + if let Some(value) = &self.groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groups", value)?; + } + if let Some(value) = &self.non_resource_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceAttributes", value)?; + } + if let Some(value) = &self.resource_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceAttributes", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SubjectAccessReviewSpec { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SubjectAccessReviewSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "extra".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "groups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Groups is the groups you're testing for.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "nonResourceAttributes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceAttributes describes information for a non-resource access request".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceAttributes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceAuthorizationAttributes describes information for a resource access request".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID information about the requesting user.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User is the user you're testing for. If you specify \"User\" but not \"Groups\", then is it interpreted as \"What if User were not a member of any groups".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/subject_access_review_status.rs b/src/v1_30/api/authorization/v1/subject_access_review_status.rs new file mode 100644 index 000000000..14a41ecc5 --- /dev/null +++ b/src/v1_30/api/authorization/v1/subject_access_review_status.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.authorization.v1.SubjectAccessReviewStatus + +/// SubjectAccessReviewStatus +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SubjectAccessReviewStatus { + /// Allowed is required. True if the action would be allowed, false otherwise. + pub allowed: bool, + + /// Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true. + pub denied: Option, + + /// EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. + pub evaluation_error: Option, + + /// Reason is optional. It indicates why a request was allowed or denied. + pub reason: Option, +} + +impl crate::DeepMerge for SubjectAccessReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allowed, other.allowed); + crate::DeepMerge::merge_from(&mut self.denied, other.denied); + crate::DeepMerge::merge_from(&mut self.evaluation_error, other.evaluation_error); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SubjectAccessReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allowed, + Key_denied, + Key_evaluation_error, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allowed" => Field::Key_allowed, + "denied" => Field::Key_denied, + "evaluationError" => Field::Key_evaluation_error, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SubjectAccessReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SubjectAccessReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allowed: Option = None; + let mut value_denied: Option = None; + let mut value_evaluation_error: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allowed => value_allowed = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_denied => value_denied = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_evaluation_error => value_evaluation_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SubjectAccessReviewStatus { + allowed: value_allowed.unwrap_or_default(), + denied: value_denied, + evaluation_error: value_evaluation_error, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "SubjectAccessReviewStatus", + &[ + "allowed", + "denied", + "evaluationError", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SubjectAccessReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SubjectAccessReviewStatus", + 1 + + self.denied.as_ref().map_or(0, |_| 1) + + self.evaluation_error.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowed", &self.allowed)?; + if let Some(value) = &self.denied { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "denied", value)?; + } + if let Some(value) = &self.evaluation_error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "evaluationError", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SubjectAccessReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SubjectAccessReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SubjectAccessReviewStatus".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allowed".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Allowed is required. True if the action would be allowed, false otherwise.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "denied".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "evaluationError".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Reason is optional. It indicates why a request was allowed or denied.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "allowed".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/authorization/v1/subject_rules_review_status.rs b/src/v1_30/api/authorization/v1/subject_rules_review_status.rs new file mode 100644 index 000000000..9d1682a3c --- /dev/null +++ b/src/v1_30/api/authorization/v1/subject_rules_review_status.rs @@ -0,0 +1,207 @@ +// Generated from definition io.k8s.api.authorization.v1.SubjectRulesReviewStatus + +/// SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SubjectRulesReviewStatus { + /// EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete. + pub evaluation_error: Option, + + /// Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. + pub incomplete: bool, + + /// NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete. + pub non_resource_rules: Vec, + + /// ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete. + pub resource_rules: Vec, +} + +impl crate::DeepMerge for SubjectRulesReviewStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.evaluation_error, other.evaluation_error); + crate::DeepMerge::merge_from(&mut self.incomplete, other.incomplete); + crate::merge_strategies::list::atomic(&mut self.non_resource_rules, other.non_resource_rules); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SubjectRulesReviewStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_evaluation_error, + Key_incomplete, + Key_non_resource_rules, + Key_resource_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "evaluationError" => Field::Key_evaluation_error, + "incomplete" => Field::Key_incomplete, + "nonResourceRules" => Field::Key_non_resource_rules, + "resourceRules" => Field::Key_resource_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SubjectRulesReviewStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SubjectRulesReviewStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_evaluation_error: Option = None; + let mut value_incomplete: Option = None; + let mut value_non_resource_rules: Option> = None; + let mut value_resource_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_evaluation_error => value_evaluation_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_incomplete => value_incomplete = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_non_resource_rules => value_non_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SubjectRulesReviewStatus { + evaluation_error: value_evaluation_error, + incomplete: value_incomplete.unwrap_or_default(), + non_resource_rules: value_non_resource_rules.unwrap_or_default(), + resource_rules: value_resource_rules.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "SubjectRulesReviewStatus", + &[ + "evaluationError", + "incomplete", + "nonResourceRules", + "resourceRules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SubjectRulesReviewStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SubjectRulesReviewStatus", + 3 + + self.evaluation_error.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.evaluation_error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "evaluationError", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "incomplete", &self.incomplete)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceRules", &self.non_resource_rules)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", &self.resource_rules)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SubjectRulesReviewStatus { + fn schema_name() -> String { + "io.k8s.api.authorization.v1.SubjectRulesReviewStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "evaluationError".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "incomplete".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "nonResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "incomplete".to_owned(), + "nonResourceRules".to_owned(), + "resourceRules".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/mod.rs b/src/v1_30/api/autoscaling/mod.rs new file mode 100644 index 000000000..4df2b61f9 --- /dev/null +++ b/src/v1_30/api/autoscaling/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v2; diff --git a/src/v1_30/api/autoscaling/v1/cross_version_object_reference.rs b/src/v1_30/api/autoscaling/v1/cross_version_object_reference.rs new file mode 100644 index 000000000..f60beb06a --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/cross_version_object_reference.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.autoscaling.v1.CrossVersionObjectReference + +/// CrossVersionObjectReference contains enough information to let you identify the referred resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CrossVersionObjectReference { + /// apiVersion is the API version of the referent + pub api_version: Option, + + /// kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub kind: String, + + /// name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: String, +} + +impl crate::DeepMerge for CrossVersionObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CrossVersionObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CrossVersionObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CrossVersionObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CrossVersionObjectReference { + api_version: value_api_version, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CrossVersionObjectReference", + &[ + "apiVersion", + "kind", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CrossVersionObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CrossVersionObjectReference", + 2 + + self.api_version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CrossVersionObjectReference { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.CrossVersionObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CrossVersionObjectReference contains enough information to let you identify the referred resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("apiVersion is the API version of the referent".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler.rs b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler.rs new file mode 100644 index 000000000..7052aebdb --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler + +/// configuration of a horizontal pod autoscaler. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscaler { + /// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + pub spec: Option, + + /// status is the current information about the autoscaler. + pub status: Option, +} + +impl crate::Resource for HorizontalPodAutoscaler { + const API_VERSION: &'static str = "autoscaling/v1"; + const GROUP: &'static str = "autoscaling"; + const KIND: &'static str = "HorizontalPodAutoscaler"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "horizontalpodautoscalers"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for HorizontalPodAutoscaler { + const LIST_KIND: &'static str = "HorizontalPodAutoscalerList"; +} + +impl crate::Metadata for HorizontalPodAutoscaler { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for HorizontalPodAutoscaler { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscaler { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscaler; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscaler { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscaler { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscaler { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("configuration of a horizontal pod autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the current information about the autoscaler.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_spec.rs b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_spec.rs new file mode 100644 index 000000000..a3678b6d5 --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_spec.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerSpec + +/// specification of a horizontal pod autoscaler. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerSpec { + /// maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. + pub max_replicas: i32, + + /// minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. + pub min_replicas: Option, + + /// reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource. + pub scale_target_ref: crate::api::autoscaling::v1::CrossVersionObjectReference, + + /// targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used. + pub target_cpu_utilization_percentage: Option, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.max_replicas, other.max_replicas); + crate::DeepMerge::merge_from(&mut self.min_replicas, other.min_replicas); + crate::DeepMerge::merge_from(&mut self.scale_target_ref, other.scale_target_ref); + crate::DeepMerge::merge_from(&mut self.target_cpu_utilization_percentage, other.target_cpu_utilization_percentage); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_max_replicas, + Key_min_replicas, + Key_scale_target_ref, + Key_target_cpu_utilization_percentage, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "maxReplicas" => Field::Key_max_replicas, + "minReplicas" => Field::Key_min_replicas, + "scaleTargetRef" => Field::Key_scale_target_ref, + "targetCPUUtilizationPercentage" => Field::Key_target_cpu_utilization_percentage, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_max_replicas: Option = None; + let mut value_min_replicas: Option = None; + let mut value_scale_target_ref: Option = None; + let mut value_target_cpu_utilization_percentage: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_max_replicas => value_max_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_replicas => value_min_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scale_target_ref => value_scale_target_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_cpu_utilization_percentage => value_target_cpu_utilization_percentage = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerSpec { + max_replicas: value_max_replicas.unwrap_or_default(), + min_replicas: value_min_replicas, + scale_target_ref: value_scale_target_ref.unwrap_or_default(), + target_cpu_utilization_percentage: value_target_cpu_utilization_percentage, + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerSpec", + &[ + "maxReplicas", + "minReplicas", + "scaleTargetRef", + "targetCPUUtilizationPercentage", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerSpec", + 2 + + self.min_replicas.as_ref().map_or(0, |_| 1) + + self.target_cpu_utilization_percentage.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxReplicas", &self.max_replicas)?; + if let Some(value) = &self.min_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleTargetRef", &self.scale_target_ref)?; + if let Some(value) = &self.target_cpu_utilization_percentage { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetCPUUtilizationPercentage", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerSpec { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("specification of a horizontal pod autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "maxReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "minReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "scaleTargetRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "targetCPUUtilizationPercentage".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "maxReplicas".to_owned(), + "scaleTargetRef".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_status.rs b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_status.rs new file mode 100644 index 000000000..68be55ec4 --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/horizontal_pod_autoscaler_status.rs @@ -0,0 +1,230 @@ +// Generated from definition io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerStatus + +/// current status of a horizontal pod autoscaler +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerStatus { + /// currentCPUUtilizationPercentage is the current average CPU utilization over all pods, represented as a percentage of requested CPU, e.g. 70 means that an average pod is using now 70% of its requested CPU. + pub current_cpu_utilization_percentage: Option, + + /// currentReplicas is the current number of replicas of pods managed by this autoscaler. + pub current_replicas: i32, + + /// desiredReplicas is the desired number of replicas of pods managed by this autoscaler. + pub desired_replicas: i32, + + /// lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods; used by the autoscaler to control how often the number of pods is changed. + pub last_scale_time: Option, + + /// observedGeneration is the most recent generation observed by this autoscaler. + pub observed_generation: Option, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.current_cpu_utilization_percentage, other.current_cpu_utilization_percentage); + crate::DeepMerge::merge_from(&mut self.current_replicas, other.current_replicas); + crate::DeepMerge::merge_from(&mut self.desired_replicas, other.desired_replicas); + crate::DeepMerge::merge_from(&mut self.last_scale_time, other.last_scale_time); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_current_cpu_utilization_percentage, + Key_current_replicas, + Key_desired_replicas, + Key_last_scale_time, + Key_observed_generation, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "currentCPUUtilizationPercentage" => Field::Key_current_cpu_utilization_percentage, + "currentReplicas" => Field::Key_current_replicas, + "desiredReplicas" => Field::Key_desired_replicas, + "lastScaleTime" => Field::Key_last_scale_time, + "observedGeneration" => Field::Key_observed_generation, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_current_cpu_utilization_percentage: Option = None; + let mut value_current_replicas: Option = None; + let mut value_desired_replicas: Option = None; + let mut value_last_scale_time: Option = None; + let mut value_observed_generation: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_current_cpu_utilization_percentage => value_current_cpu_utilization_percentage = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_replicas => value_current_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_desired_replicas => value_desired_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_scale_time => value_last_scale_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerStatus { + current_cpu_utilization_percentage: value_current_cpu_utilization_percentage, + current_replicas: value_current_replicas.unwrap_or_default(), + desired_replicas: value_desired_replicas.unwrap_or_default(), + last_scale_time: value_last_scale_time, + observed_generation: value_observed_generation, + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerStatus", + &[ + "currentCPUUtilizationPercentage", + "currentReplicas", + "desiredReplicas", + "lastScaleTime", + "observedGeneration", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerStatus", + 2 + + self.current_cpu_utilization_percentage.as_ref().map_or(0, |_| 1) + + self.last_scale_time.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.current_cpu_utilization_percentage { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentCPUUtilizationPercentage", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentReplicas", &self.current_replicas)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "desiredReplicas", &self.desired_replicas)?; + if let Some(value) = &self.last_scale_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastScaleTime", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.HorizontalPodAutoscalerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current status of a horizontal pod autoscaler".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "currentCPUUtilizationPercentage".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentCPUUtilizationPercentage is the current average CPU utilization over all pods, represented as a percentage of requested CPU, e.g. 70 means that an average pod is using now 70% of its requested CPU.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "currentReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentReplicas is the current number of replicas of pods managed by this autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "desiredReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("desiredReplicas is the desired number of replicas of pods managed by this autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lastScaleTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods; used by the autoscaler to control how often the number of pods is changed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("observedGeneration is the most recent generation observed by this autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "currentReplicas".to_owned(), + "desiredReplicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/mod.rs b/src/v1_30/api/autoscaling/v1/mod.rs new file mode 100644 index 000000000..3ad43beb8 --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/mod.rs @@ -0,0 +1,21 @@ + +mod cross_version_object_reference; +pub use self::cross_version_object_reference::CrossVersionObjectReference; + +mod horizontal_pod_autoscaler; +pub use self::horizontal_pod_autoscaler::HorizontalPodAutoscaler; + +mod horizontal_pod_autoscaler_spec; +pub use self::horizontal_pod_autoscaler_spec::HorizontalPodAutoscalerSpec; + +mod horizontal_pod_autoscaler_status; +pub use self::horizontal_pod_autoscaler_status::HorizontalPodAutoscalerStatus; + +mod scale; +pub use self::scale::Scale; + +mod scale_spec; +pub use self::scale_spec::ScaleSpec; + +mod scale_status; +pub use self::scale_status::ScaleStatus; diff --git a/src/v1_30/api/autoscaling/v1/scale.rs b/src/v1_30/api/autoscaling/v1/scale.rs new file mode 100644 index 000000000..04cd37e6f --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/scale.rs @@ -0,0 +1,241 @@ +// Generated from definition io.k8s.api.autoscaling.v1.Scale + +/// Scale represents a scaling request for a resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Scale { + /// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + pub spec: Option, + + /// status is the current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only. + pub status: Option, +} + +impl crate::Resource for Scale { + const API_VERSION: &'static str = "autoscaling/v1"; + const GROUP: &'static str = "autoscaling"; + const KIND: &'static str = "Scale"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "scale"; + type Scope = crate::SubResourceScope; +} + +impl crate::Metadata for Scale { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Scale { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Scale { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Scale; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Scale { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Scale { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Scale { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.Scale".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Scale represents a scaling request for a resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/scale_spec.rs b/src/v1_30/api/autoscaling/v1/scale_spec.rs new file mode 100644 index 000000000..a99407cb1 --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/scale_spec.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.autoscaling.v1.ScaleSpec + +/// ScaleSpec describes the attributes of a scale subresource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScaleSpec { + /// replicas is the desired number of instances for the scaled object. + pub replicas: Option, +} + +impl crate::DeepMerge for ScaleSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScaleSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_replicas, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "replicas" => Field::Key_replicas, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScaleSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScaleSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_replicas: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScaleSpec { + replicas: value_replicas, + }) + } + } + + deserializer.deserialize_struct( + "ScaleSpec", + &[ + "replicas", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScaleSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScaleSpec", + self.replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScaleSpec { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.ScaleSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ScaleSpec describes the attributes of a scale subresource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("replicas is the desired number of instances for the scaled object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v1/scale_status.rs b/src/v1_30/api/autoscaling/v1/scale_status.rs new file mode 100644 index 000000000..2b9708046 --- /dev/null +++ b/src/v1_30/api/autoscaling/v1/scale_status.rs @@ -0,0 +1,154 @@ +// Generated from definition io.k8s.api.autoscaling.v1.ScaleStatus + +/// ScaleStatus represents the current status of a scale subresource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScaleStatus { + /// replicas is the actual number of observed instances of the scaled object. + pub replicas: i32, + + /// selector is the label query over pods that should match the replicas count. This is same as the label selector but in the string format to avoid introspection by clients. The string will be in the same format as the query-param syntax. More info about label selectors: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ + pub selector: Option, +} + +impl crate::DeepMerge for ScaleStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScaleStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_replicas, + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "replicas" => Field::Key_replicas, + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScaleStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScaleStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_replicas: Option = None; + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScaleStatus { + replicas: value_replicas.unwrap_or_default(), + selector: value_selector, + }) + } + } + + deserializer.deserialize_struct( + "ScaleStatus", + &[ + "replicas", + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScaleStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScaleStatus", + 1 + + self.selector.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", &self.replicas)?; + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScaleStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v1.ScaleStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ScaleStatus represents the current status of a scale subresource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("replicas is the actual number of observed instances of the scaled object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector is the label query over pods that should match the replicas count. This is same as the label selector but in the string format to avoid introspection by clients. The string will be in the same format as the query-param syntax. More info about label selectors: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "replicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/container_resource_metric_source.rs b/src/v1_30/api/autoscaling/v2/container_resource_metric_source.rs new file mode 100644 index 000000000..f429b7a15 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/container_resource_metric_source.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ContainerResourceMetricSource + +/// ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerResourceMetricSource { + /// container is the name of the container in the pods of the scaling target + pub container: String, + + /// name is the name of the resource in question. + pub name: String, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2::MetricTarget, +} + +impl crate::DeepMerge for ContainerResourceMetricSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container, other.container); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerResourceMetricSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container, + Key_name, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "container" => Field::Key_container, + "name" => Field::Key_name, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerResourceMetricSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerResourceMetricSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container: Option = None; + let mut value_name: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container => value_container = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerResourceMetricSource { + container: value_container.unwrap_or_default(), + name: value_name.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ContainerResourceMetricSource", + &[ + "container", + "name", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerResourceMetricSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerResourceMetricSource", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "container", &self.container)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerResourceMetricSource { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ContainerResourceMetricSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "container".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("container is the name of the container in the pods of the scaling target".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource in question.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("target specifies the target value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "container".to_owned(), + "name".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/container_resource_metric_status.rs b/src/v1_30/api/autoscaling/v2/container_resource_metric_status.rs new file mode 100644 index 000000000..3fdf7210c --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/container_resource_metric_status.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ContainerResourceMetricStatus + +/// ContainerResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerResourceMetricStatus { + /// container is the name of the container in the pods of the scaling target + pub container: String, + + /// current contains the current value for the given metric + pub current: crate::api::autoscaling::v2::MetricValueStatus, + + /// name is the name of the resource in question. + pub name: String, +} + +impl crate::DeepMerge for ContainerResourceMetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container, other.container); + crate::DeepMerge::merge_from(&mut self.current, other.current); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerResourceMetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container, + Key_current, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "container" => Field::Key_container, + "current" => Field::Key_current, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerResourceMetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerResourceMetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container: Option = None; + let mut value_current: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container => value_container = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current => value_current = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerResourceMetricStatus { + container: value_container.unwrap_or_default(), + current: value_current.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ContainerResourceMetricStatus", + &[ + "container", + "current", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerResourceMetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerResourceMetricStatus", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "container", &self.container)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "current", &self.current)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerResourceMetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ContainerResourceMetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "container".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("container is the name of the container in the pods of the scaling target".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "current".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current contains the current value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource in question.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "container".to_owned(), + "current".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/cross_version_object_reference.rs b/src/v1_30/api/autoscaling/v2/cross_version_object_reference.rs new file mode 100644 index 000000000..0f93a04de --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/cross_version_object_reference.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.autoscaling.v2.CrossVersionObjectReference + +/// CrossVersionObjectReference contains enough information to let you identify the referred resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CrossVersionObjectReference { + /// apiVersion is the API version of the referent + pub api_version: Option, + + /// kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub kind: String, + + /// name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: String, +} + +impl crate::DeepMerge for CrossVersionObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CrossVersionObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CrossVersionObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CrossVersionObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CrossVersionObjectReference { + api_version: value_api_version, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CrossVersionObjectReference", + &[ + "apiVersion", + "kind", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CrossVersionObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CrossVersionObjectReference", + 2 + + self.api_version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CrossVersionObjectReference { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.CrossVersionObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CrossVersionObjectReference contains enough information to let you identify the referred resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("apiVersion is the API version of the referent".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/external_metric_source.rs b/src/v1_30/api/autoscaling/v2/external_metric_source.rs new file mode 100644 index 000000000..35ca73057 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/external_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ExternalMetricSource + +/// ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExternalMetricSource { + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2::MetricTarget, +} + +impl crate::DeepMerge for ExternalMetricSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExternalMetricSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metric, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metric" => Field::Key_metric, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExternalMetricSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExternalMetricSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metric: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExternalMetricSource { + metric: value_metric.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ExternalMetricSource", + &[ + "metric", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExternalMetricSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExternalMetricSource", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExternalMetricSource { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ExternalMetricSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("target specifies the target value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metric".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/external_metric_status.rs b/src/v1_30/api/autoscaling/v2/external_metric_status.rs new file mode 100644 index 000000000..af69d9d65 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/external_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ExternalMetricStatus + +/// ExternalMetricStatus indicates the current value of a global metric not associated with any Kubernetes object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExternalMetricStatus { + /// current contains the current value for the given metric + pub current: crate::api::autoscaling::v2::MetricValueStatus, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, +} + +impl crate::DeepMerge for ExternalMetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.current, other.current); + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExternalMetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_current, + Key_metric, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "current" => Field::Key_current, + "metric" => Field::Key_metric, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExternalMetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExternalMetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_current: Option = None; + let mut value_metric: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_current => value_current = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExternalMetricStatus { + current: value_current.unwrap_or_default(), + metric: value_metric.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ExternalMetricStatus", + &[ + "current", + "metric", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExternalMetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExternalMetricStatus", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "current", &self.current)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExternalMetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ExternalMetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExternalMetricStatus indicates the current value of a global metric not associated with any Kubernetes object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "current".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current contains the current value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "current".to_owned(), + "metric".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler.rs b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler.rs new file mode 100644 index 000000000..e60e51dc1 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HorizontalPodAutoscaler + +/// HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscaler { + /// metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the specification for the behaviour of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. + pub spec: Option, + + /// status is the current information about the autoscaler. + pub status: Option, +} + +impl crate::Resource for HorizontalPodAutoscaler { + const API_VERSION: &'static str = "autoscaling/v2"; + const GROUP: &'static str = "autoscaling"; + const KIND: &'static str = "HorizontalPodAutoscaler"; + const VERSION: &'static str = "v2"; + const URL_PATH_SEGMENT: &'static str = "horizontalpodautoscalers"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for HorizontalPodAutoscaler { + const LIST_KIND: &'static str = "HorizontalPodAutoscalerList"; +} + +impl crate::Metadata for HorizontalPodAutoscaler { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for HorizontalPodAutoscaler { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscaler { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscaler; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscaler { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscaler { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscaler { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HorizontalPodAutoscaler".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the specification for the behaviour of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the current information about the autoscaler.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_behavior.rs b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_behavior.rs new file mode 100644 index 000000000..dade1c58b --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_behavior.rs @@ -0,0 +1,155 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerBehavior + +/// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerBehavior { + /// scaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used). + pub scale_down: Option, + + /// scaleUp is scaling policy for scaling Up. If not set, the default value is the higher of: + /// * increase no more than 4 pods per 60 seconds + /// * double the number of pods per 60 seconds + /// No stabilization is used. + pub scale_up: Option, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerBehavior { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.scale_down, other.scale_down); + crate::DeepMerge::merge_from(&mut self.scale_up, other.scale_up); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerBehavior { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_scale_down, + Key_scale_up, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "scaleDown" => Field::Key_scale_down, + "scaleUp" => Field::Key_scale_up, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerBehavior; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerBehavior") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_scale_down: Option = None; + let mut value_scale_up: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_scale_down => value_scale_down = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scale_up => value_scale_up = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerBehavior { + scale_down: value_scale_down, + scale_up: value_scale_up, + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerBehavior", + &[ + "scaleDown", + "scaleUp", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerBehavior { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerBehavior", + self.scale_down.as_ref().map_or(0, |_| 1) + + self.scale_up.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.scale_down { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleDown", value)?; + } + if let Some(value) = &self.scale_up { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleUp", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerBehavior { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerBehavior".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "scaleDown".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scaleUp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scaleUp is scaling policy for scaling Up. If not set, the default value is the higher of:\n * increase no more than 4 pods per 60 seconds\n * double the number of pods per 60 seconds\nNo stabilization is used.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_condition.rs b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_condition.rs new file mode 100644 index 000000000..14eaa48ec --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerCondition + +/// HorizontalPodAutoscalerCondition describes the state of a HorizontalPodAutoscaler at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerCondition { + /// lastTransitionTime is the last time the condition transitioned from one status to another + pub last_transition_time: Option, + + /// message is a human-readable explanation containing details about the transition + pub message: Option, + + /// reason is the reason for the condition's last transition. + pub reason: Option, + + /// status is the status of the condition (True, False, Unknown) + pub status: String, + + /// type describes the current condition + pub type_: String, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerCondition { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HorizontalPodAutoscalerCondition describes the state of a HorizontalPodAutoscaler at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastTransitionTime is the last time the condition transitioned from one status to another".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message is a human-readable explanation containing details about the transition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason is the reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the status of the condition (True, False, Unknown)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type describes the current condition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_spec.rs b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_spec.rs new file mode 100644 index 000000000..1aaf3eb86 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_spec.rs @@ -0,0 +1,232 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerSpec + +/// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerSpec { + /// behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used. + pub behavior: Option, + + /// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas. + pub max_replicas: i32, + + /// metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization. + pub metrics: Option>, + + /// minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available. + pub min_replicas: Option, + + /// scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count. + pub scale_target_ref: crate::api::autoscaling::v2::CrossVersionObjectReference, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.behavior, other.behavior); + crate::DeepMerge::merge_from(&mut self.max_replicas, other.max_replicas); + crate::merge_strategies::list::atomic(&mut self.metrics, other.metrics); + crate::DeepMerge::merge_from(&mut self.min_replicas, other.min_replicas); + crate::DeepMerge::merge_from(&mut self.scale_target_ref, other.scale_target_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_behavior, + Key_max_replicas, + Key_metrics, + Key_min_replicas, + Key_scale_target_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "behavior" => Field::Key_behavior, + "maxReplicas" => Field::Key_max_replicas, + "metrics" => Field::Key_metrics, + "minReplicas" => Field::Key_min_replicas, + "scaleTargetRef" => Field::Key_scale_target_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_behavior: Option = None; + let mut value_max_replicas: Option = None; + let mut value_metrics: Option> = None; + let mut value_min_replicas: Option = None; + let mut value_scale_target_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_behavior => value_behavior = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_replicas => value_max_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metrics => value_metrics = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_replicas => value_min_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scale_target_ref => value_scale_target_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerSpec { + behavior: value_behavior, + max_replicas: value_max_replicas.unwrap_or_default(), + metrics: value_metrics, + min_replicas: value_min_replicas, + scale_target_ref: value_scale_target_ref.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerSpec", + &[ + "behavior", + "maxReplicas", + "metrics", + "minReplicas", + "scaleTargetRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerSpec", + 2 + + self.behavior.as_ref().map_or(0, |_| 1) + + self.metrics.as_ref().map_or(0, |_| 1) + + self.min_replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.behavior { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "behavior", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxReplicas", &self.max_replicas)?; + if let Some(value) = &self.metrics { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metrics", value)?; + } + if let Some(value) = &self.min_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleTargetRef", &self.scale_target_ref)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerSpec { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "behavior".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "maxReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "metrics".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "minReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "scaleTargetRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "maxReplicas".to_owned(), + "scaleTargetRef".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs new file mode 100644 index 000000000..c4b24efd7 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/horizontal_pod_autoscaler_status.rs @@ -0,0 +1,271 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerStatus + +/// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HorizontalPodAutoscalerStatus { + /// conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met. + pub conditions: Option>, + + /// currentMetrics is the last read state of the metrics used by this autoscaler. + pub current_metrics: Option>, + + /// currentReplicas is current number of replicas of pods managed by this autoscaler, as last seen by the autoscaler. + pub current_replicas: Option, + + /// desiredReplicas is the desired number of replicas of pods managed by this autoscaler, as last calculated by the autoscaler. + pub desired_replicas: i32, + + /// lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed. + pub last_scale_time: Option, + + /// observedGeneration is the most recent generation observed by this autoscaler. + pub observed_generation: Option, +} + +impl crate::DeepMerge for HorizontalPodAutoscalerStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.current_metrics, other.current_metrics); + crate::DeepMerge::merge_from(&mut self.current_replicas, other.current_replicas); + crate::DeepMerge::merge_from(&mut self.desired_replicas, other.desired_replicas); + crate::DeepMerge::merge_from(&mut self.last_scale_time, other.last_scale_time); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HorizontalPodAutoscalerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_current_metrics, + Key_current_replicas, + Key_desired_replicas, + Key_last_scale_time, + Key_observed_generation, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "currentMetrics" => Field::Key_current_metrics, + "currentReplicas" => Field::Key_current_replicas, + "desiredReplicas" => Field::Key_desired_replicas, + "lastScaleTime" => Field::Key_last_scale_time, + "observedGeneration" => Field::Key_observed_generation, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HorizontalPodAutoscalerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HorizontalPodAutoscalerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_current_metrics: Option> = None; + let mut value_current_replicas: Option = None; + let mut value_desired_replicas: Option = None; + let mut value_last_scale_time: Option = None; + let mut value_observed_generation: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_metrics => value_current_metrics = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_replicas => value_current_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_desired_replicas => value_desired_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_scale_time => value_last_scale_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HorizontalPodAutoscalerStatus { + conditions: value_conditions, + current_metrics: value_current_metrics, + current_replicas: value_current_replicas, + desired_replicas: value_desired_replicas.unwrap_or_default(), + last_scale_time: value_last_scale_time, + observed_generation: value_observed_generation, + }) + } + } + + deserializer.deserialize_struct( + "HorizontalPodAutoscalerStatus", + &[ + "conditions", + "currentMetrics", + "currentReplicas", + "desiredReplicas", + "lastScaleTime", + "observedGeneration", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HorizontalPodAutoscalerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HorizontalPodAutoscalerStatus", + 1 + + self.conditions.as_ref().map_or(0, |_| 1) + + self.current_metrics.as_ref().map_or(0, |_| 1) + + self.current_replicas.as_ref().map_or(0, |_| 1) + + self.last_scale_time.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.current_metrics { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentMetrics", value)?; + } + if let Some(value) = &self.current_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "desiredReplicas", &self.desired_replicas)?; + if let Some(value) = &self.last_scale_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastScaleTime", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HorizontalPodAutoscalerStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentMetrics".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentMetrics is the last read state of the metrics used by this autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentReplicas is current number of replicas of pods managed by this autoscaler, as last seen by the autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "desiredReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("desiredReplicas is the desired number of replicas of pods managed by this autoscaler, as last calculated by the autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lastScaleTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("observedGeneration is the most recent generation observed by this autoscaler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "desiredReplicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/hpa_scaling_policy.rs b/src/v1_30/api/autoscaling/v2/hpa_scaling_policy.rs new file mode 100644 index 000000000..9804ec7d6 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/hpa_scaling_policy.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HPAScalingPolicy + +/// HPAScalingPolicy is a single policy which must hold true for a specified past interval. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HPAScalingPolicy { + /// periodSeconds specifies the window of time for which the policy should hold true. PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + pub period_seconds: i32, + + /// type is used to specify the scaling policy. + pub type_: String, + + /// value contains the amount of change which is permitted by the policy. It must be greater than zero + pub value: i32, +} + +impl crate::DeepMerge for HPAScalingPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.period_seconds, other.period_seconds); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HPAScalingPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_period_seconds, + Key_type_, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "periodSeconds" => Field::Key_period_seconds, + "type" => Field::Key_type_, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HPAScalingPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HPAScalingPolicy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_period_seconds: Option = None; + let mut value_type_: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_period_seconds => value_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HPAScalingPolicy { + period_seconds: value_period_seconds.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + value: value_value.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HPAScalingPolicy", + &[ + "periodSeconds", + "type", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HPAScalingPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HPAScalingPolicy", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "periodSeconds", &self.period_seconds)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", &self.value)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HPAScalingPolicy { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HPAScalingPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HPAScalingPolicy is a single policy which must hold true for a specified past interval.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "periodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("periodSeconds specifies the window of time for which the policy should hold true. PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is used to specify the scaling policy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("value contains the amount of change which is permitted by the policy. It must be greater than zero".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "periodSeconds".to_owned(), + "type".to_owned(), + "value".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/hpa_scaling_rules.rs b/src/v1_30/api/autoscaling/v2/hpa_scaling_rules.rs new file mode 100644 index 000000000..887652d1e --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/hpa_scaling_rules.rs @@ -0,0 +1,182 @@ +// Generated from definition io.k8s.api.autoscaling.v2.HPAScalingRules + +/// HPAScalingRules configures the scaling behavior for one direction. These Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HPAScalingRules { + /// policies is a list of potential scaling polices which can be used during scaling. At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid + pub policies: Option>, + + /// selectPolicy is used to specify which policy should be used. If not set, the default value Max is used. + pub select_policy: Option, + + /// stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long). + pub stabilization_window_seconds: Option, +} + +impl crate::DeepMerge for HPAScalingRules { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.policies, other.policies); + crate::DeepMerge::merge_from(&mut self.select_policy, other.select_policy); + crate::DeepMerge::merge_from(&mut self.stabilization_window_seconds, other.stabilization_window_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HPAScalingRules { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_policies, + Key_select_policy, + Key_stabilization_window_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "policies" => Field::Key_policies, + "selectPolicy" => Field::Key_select_policy, + "stabilizationWindowSeconds" => Field::Key_stabilization_window_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HPAScalingRules; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HPAScalingRules") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_policies: Option> = None; + let mut value_select_policy: Option = None; + let mut value_stabilization_window_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_policies => value_policies = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_select_policy => value_select_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stabilization_window_seconds => value_stabilization_window_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HPAScalingRules { + policies: value_policies, + select_policy: value_select_policy, + stabilization_window_seconds: value_stabilization_window_seconds, + }) + } + } + + deserializer.deserialize_struct( + "HPAScalingRules", + &[ + "policies", + "selectPolicy", + "stabilizationWindowSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HPAScalingRules { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HPAScalingRules", + self.policies.as_ref().map_or(0, |_| 1) + + self.select_policy.as_ref().map_or(0, |_| 1) + + self.stabilization_window_seconds.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.policies { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "policies", value)?; + } + if let Some(value) = &self.select_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selectPolicy", value)?; + } + if let Some(value) = &self.stabilization_window_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stabilizationWindowSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HPAScalingRules { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.HPAScalingRules".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HPAScalingRules configures the scaling behavior for one direction. These Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "policies".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("policies is a list of potential scaling polices which can be used during scaling. At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "selectPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selectPolicy is used to specify which policy should be used. If not set, the default value Max is used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "stabilizationWindowSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/metric_identifier.rs b/src/v1_30/api/autoscaling/v2/metric_identifier.rs new file mode 100644 index 000000000..09496c02c --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/metric_identifier.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.autoscaling.v2.MetricIdentifier + +/// MetricIdentifier defines the name and optionally selector for a metric +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MetricIdentifier { + /// name is the name of the given metric + pub name: String, + + /// selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. + pub selector: Option, +} + +impl crate::DeepMerge for MetricIdentifier { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MetricIdentifier { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MetricIdentifier; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MetricIdentifier") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MetricIdentifier { + name: value_name.unwrap_or_default(), + selector: value_selector, + }) + } + } + + deserializer.deserialize_struct( + "MetricIdentifier", + &[ + "name", + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MetricIdentifier { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MetricIdentifier", + 1 + + self.selector.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MetricIdentifier { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.MetricIdentifier".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MetricIdentifier defines the name and optionally selector for a metric".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the given metric".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/metric_spec.rs b/src/v1_30/api/autoscaling/v2/metric_spec.rs new file mode 100644 index 000000000..d370e3eae --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/metric_spec.rs @@ -0,0 +1,253 @@ +// Generated from definition io.k8s.api.autoscaling.v2.MetricSpec + +/// MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MetricSpec { + /// containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. + pub container_resource: Option, + + /// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). + pub external: Option, + + /// object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). + pub object: Option, + + /// pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. + pub pods: Option, + + /// resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. + pub resource: Option, + + /// type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled + pub type_: String, +} + +impl crate::DeepMerge for MetricSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_resource, other.container_resource); + crate::DeepMerge::merge_from(&mut self.external, other.external); + crate::DeepMerge::merge_from(&mut self.object, other.object); + crate::DeepMerge::merge_from(&mut self.pods, other.pods); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MetricSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_resource, + Key_external, + Key_object, + Key_pods, + Key_resource, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerResource" => Field::Key_container_resource, + "external" => Field::Key_external, + "object" => Field::Key_object, + "pods" => Field::Key_pods, + "resource" => Field::Key_resource, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MetricSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MetricSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_resource: Option = None; + let mut value_external: Option = None; + let mut value_object: Option = None; + let mut value_pods: Option = None; + let mut value_resource: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_resource => value_container_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external => value_external = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object => value_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pods => value_pods = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MetricSpec { + container_resource: value_container_resource, + external: value_external, + object: value_object, + pods: value_pods, + resource: value_resource, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MetricSpec", + &[ + "containerResource", + "external", + "object", + "pods", + "resource", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MetricSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MetricSpec", + 1 + + self.container_resource.as_ref().map_or(0, |_| 1) + + self.external.as_ref().map_or(0, |_| 1) + + self.object.as_ref().map_or(0, |_| 1) + + self.pods.as_ref().map_or(0, |_| 1) + + self.resource.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.container_resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerResource", value)?; + } + if let Some(value) = &self.external { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "external", value)?; + } + if let Some(value) = &self.object { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", value)?; + } + if let Some(value) = &self.pods { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pods", value)?; + } + if let Some(value) = &self.resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MetricSpec { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.MetricSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerResource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "external".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "object".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "pods".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is the type of metric source. It should be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each mapping to a matching field in the object. Note: \"ContainerResource\" type is available on when the feature-gate HPAContainerMetrics is enabled".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/metric_status.rs b/src/v1_30/api/autoscaling/v2/metric_status.rs new file mode 100644 index 000000000..90f500d64 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/metric_status.rs @@ -0,0 +1,253 @@ +// Generated from definition io.k8s.api.autoscaling.v2.MetricStatus + +/// MetricStatus describes the last-read state of a single metric. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MetricStatus { + /// container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. + pub container_resource: Option, + + /// external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). + pub external: Option, + + /// object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). + pub object: Option, + + /// pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. + pub pods: Option, + + /// resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. + pub resource: Option, + + /// type is the type of metric source. It will be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled + pub type_: String, +} + +impl crate::DeepMerge for MetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_resource, other.container_resource); + crate::DeepMerge::merge_from(&mut self.external, other.external); + crate::DeepMerge::merge_from(&mut self.object, other.object); + crate::DeepMerge::merge_from(&mut self.pods, other.pods); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_resource, + Key_external, + Key_object, + Key_pods, + Key_resource, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerResource" => Field::Key_container_resource, + "external" => Field::Key_external, + "object" => Field::Key_object, + "pods" => Field::Key_pods, + "resource" => Field::Key_resource, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_resource: Option = None; + let mut value_external: Option = None; + let mut value_object: Option = None; + let mut value_pods: Option = None; + let mut value_resource: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_resource => value_container_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external => value_external = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object => value_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pods => value_pods = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MetricStatus { + container_resource: value_container_resource, + external: value_external, + object: value_object, + pods: value_pods, + resource: value_resource, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MetricStatus", + &[ + "containerResource", + "external", + "object", + "pods", + "resource", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MetricStatus", + 1 + + self.container_resource.as_ref().map_or(0, |_| 1) + + self.external.as_ref().map_or(0, |_| 1) + + self.object.as_ref().map_or(0, |_| 1) + + self.pods.as_ref().map_or(0, |_| 1) + + self.resource.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.container_resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerResource", value)?; + } + if let Some(value) = &self.external { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "external", value)?; + } + if let Some(value) = &self.object { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", value)?; + } + if let Some(value) = &self.pods { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pods", value)?; + } + if let Some(value) = &self.resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.MetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MetricStatus describes the last-read state of a single metric.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerResource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "external".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "object".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "pods".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is the type of metric source. It will be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each corresponds to a matching field in the object. Note: \"ContainerResource\" type is available on when the feature-gate HPAContainerMetrics is enabled".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/metric_target.rs b/src/v1_30/api/autoscaling/v2/metric_target.rs new file mode 100644 index 000000000..dd7303718 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/metric_target.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.autoscaling.v2.MetricTarget + +/// MetricTarget defines the target value, average value, or average utilization of a specific metric +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MetricTarget { + /// averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type + pub average_utilization: Option, + + /// averageValue is the target value of the average of the metric across all relevant pods (as a quantity) + pub average_value: Option, + + /// type represents whether the metric type is Utilization, Value, or AverageValue + pub type_: String, + + /// value is the target value of the metric (as a quantity). + pub value: Option, +} + +impl crate::DeepMerge for MetricTarget { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.average_utilization, other.average_utilization); + crate::DeepMerge::merge_from(&mut self.average_value, other.average_value); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MetricTarget { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_average_utilization, + Key_average_value, + Key_type_, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "averageUtilization" => Field::Key_average_utilization, + "averageValue" => Field::Key_average_value, + "type" => Field::Key_type_, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MetricTarget; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MetricTarget") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_average_utilization: Option = None; + let mut value_average_value: Option = None; + let mut value_type_: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_average_utilization => value_average_utilization = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_average_value => value_average_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MetricTarget { + average_utilization: value_average_utilization, + average_value: value_average_value, + type_: value_type_.unwrap_or_default(), + value: value_value, + }) + } + } + + deserializer.deserialize_struct( + "MetricTarget", + &[ + "averageUtilization", + "averageValue", + "type", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MetricTarget { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MetricTarget", + 1 + + self.average_utilization.as_ref().map_or(0, |_| 1) + + self.average_value.as_ref().map_or(0, |_| 1) + + self.value.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.average_utilization { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "averageUtilization", value)?; + } + if let Some(value) = &self.average_value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "averageValue", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MetricTarget { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.MetricTarget".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MetricTarget defines the target value, average value, or average utilization of a specific metric".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "averageUtilization".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "averageValue".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("averageValue is the target value of the average of the metric across all relevant pods (as a quantity)".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type represents whether the metric type is Utilization, Value, or AverageValue".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("value is the target value of the metric (as a quantity).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/metric_value_status.rs b/src/v1_30/api/autoscaling/v2/metric_value_status.rs new file mode 100644 index 000000000..816cdef6a --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/metric_value_status.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.autoscaling.v2.MetricValueStatus + +/// MetricValueStatus holds the current value for a metric +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MetricValueStatus { + /// currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. + pub average_utilization: Option, + + /// averageValue is the current value of the average of the metric across all relevant pods (as a quantity) + pub average_value: Option, + + /// value is the current value of the metric (as a quantity). + pub value: Option, +} + +impl crate::DeepMerge for MetricValueStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.average_utilization, other.average_utilization); + crate::DeepMerge::merge_from(&mut self.average_value, other.average_value); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MetricValueStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_average_utilization, + Key_average_value, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "averageUtilization" => Field::Key_average_utilization, + "averageValue" => Field::Key_average_value, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MetricValueStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MetricValueStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_average_utilization: Option = None; + let mut value_average_value: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_average_utilization => value_average_utilization = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_average_value => value_average_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MetricValueStatus { + average_utilization: value_average_utilization, + average_value: value_average_value, + value: value_value, + }) + } + } + + deserializer.deserialize_struct( + "MetricValueStatus", + &[ + "averageUtilization", + "averageValue", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MetricValueStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MetricValueStatus", + self.average_utilization.as_ref().map_or(0, |_| 1) + + self.average_value.as_ref().map_or(0, |_| 1) + + self.value.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.average_utilization { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "averageUtilization", value)?; + } + if let Some(value) = &self.average_value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "averageValue", value)?; + } + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MetricValueStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.MetricValueStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MetricValueStatus holds the current value for a metric".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "averageUtilization".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "averageValue".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("averageValue is the current value of the average of the metric across all relevant pods (as a quantity)".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "value".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("value is the current value of the metric (as a quantity).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/mod.rs b/src/v1_30/api/autoscaling/v2/mod.rs new file mode 100644 index 000000000..9e4929efe --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/mod.rs @@ -0,0 +1,69 @@ + +mod container_resource_metric_source; +pub use self::container_resource_metric_source::ContainerResourceMetricSource; + +mod container_resource_metric_status; +pub use self::container_resource_metric_status::ContainerResourceMetricStatus; + +mod cross_version_object_reference; +pub use self::cross_version_object_reference::CrossVersionObjectReference; + +mod external_metric_source; +pub use self::external_metric_source::ExternalMetricSource; + +mod external_metric_status; +pub use self::external_metric_status::ExternalMetricStatus; + +mod hpa_scaling_policy; +pub use self::hpa_scaling_policy::HPAScalingPolicy; + +mod hpa_scaling_rules; +pub use self::hpa_scaling_rules::HPAScalingRules; + +mod horizontal_pod_autoscaler; +pub use self::horizontal_pod_autoscaler::HorizontalPodAutoscaler; + +mod horizontal_pod_autoscaler_behavior; +pub use self::horizontal_pod_autoscaler_behavior::HorizontalPodAutoscalerBehavior; + +mod horizontal_pod_autoscaler_condition; +pub use self::horizontal_pod_autoscaler_condition::HorizontalPodAutoscalerCondition; + +mod horizontal_pod_autoscaler_spec; +pub use self::horizontal_pod_autoscaler_spec::HorizontalPodAutoscalerSpec; + +mod horizontal_pod_autoscaler_status; +pub use self::horizontal_pod_autoscaler_status::HorizontalPodAutoscalerStatus; + +mod metric_identifier; +pub use self::metric_identifier::MetricIdentifier; + +mod metric_spec; +pub use self::metric_spec::MetricSpec; + +mod metric_status; +pub use self::metric_status::MetricStatus; + +mod metric_target; +pub use self::metric_target::MetricTarget; + +mod metric_value_status; +pub use self::metric_value_status::MetricValueStatus; + +mod object_metric_source; +pub use self::object_metric_source::ObjectMetricSource; + +mod object_metric_status; +pub use self::object_metric_status::ObjectMetricStatus; + +mod pods_metric_source; +pub use self::pods_metric_source::PodsMetricSource; + +mod pods_metric_status; +pub use self::pods_metric_status::PodsMetricStatus; + +mod resource_metric_source; +pub use self::resource_metric_source::ResourceMetricSource; + +mod resource_metric_status; +pub use self::resource_metric_status::ResourceMetricStatus; diff --git a/src/v1_30/api/autoscaling/v2/object_metric_source.rs b/src/v1_30/api/autoscaling/v2/object_metric_source.rs new file mode 100644 index 000000000..e1a8ef047 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/object_metric_source.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ObjectMetricSource + +/// ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ObjectMetricSource { + /// describedObject specifies the descriptions of a object,such as kind,name apiVersion + pub described_object: crate::api::autoscaling::v2::CrossVersionObjectReference, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2::MetricTarget, +} + +impl crate::DeepMerge for ObjectMetricSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.described_object, other.described_object); + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ObjectMetricSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_described_object, + Key_metric, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "describedObject" => Field::Key_described_object, + "metric" => Field::Key_metric, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ObjectMetricSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectMetricSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_described_object: Option = None; + let mut value_metric: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_described_object => value_described_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ObjectMetricSource { + described_object: value_described_object.unwrap_or_default(), + metric: value_metric.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ObjectMetricSource", + &[ + "describedObject", + "metric", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ObjectMetricSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectMetricSource", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "describedObject", &self.described_object)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ObjectMetricSource { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ObjectMetricSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "describedObject".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("describedObject specifies the descriptions of a object,such as kind,name apiVersion".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("target specifies the target value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "describedObject".to_owned(), + "metric".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/object_metric_status.rs b/src/v1_30/api/autoscaling/v2/object_metric_status.rs new file mode 100644 index 000000000..2e0f25d3d --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/object_metric_status.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ObjectMetricStatus + +/// ObjectMetricStatus indicates the current value of a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ObjectMetricStatus { + /// current contains the current value for the given metric + pub current: crate::api::autoscaling::v2::MetricValueStatus, + + /// DescribedObject specifies the descriptions of a object,such as kind,name apiVersion + pub described_object: crate::api::autoscaling::v2::CrossVersionObjectReference, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, +} + +impl crate::DeepMerge for ObjectMetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.current, other.current); + crate::DeepMerge::merge_from(&mut self.described_object, other.described_object); + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ObjectMetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_current, + Key_described_object, + Key_metric, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "current" => Field::Key_current, + "describedObject" => Field::Key_described_object, + "metric" => Field::Key_metric, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ObjectMetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectMetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_current: Option = None; + let mut value_described_object: Option = None; + let mut value_metric: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_current => value_current = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_described_object => value_described_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ObjectMetricStatus { + current: value_current.unwrap_or_default(), + described_object: value_described_object.unwrap_or_default(), + metric: value_metric.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ObjectMetricStatus", + &[ + "current", + "describedObject", + "metric", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ObjectMetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectMetricStatus", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "current", &self.current)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "describedObject", &self.described_object)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ObjectMetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ObjectMetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectMetricStatus indicates the current value of a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "current".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current contains the current value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "describedObject".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DescribedObject specifies the descriptions of a object,such as kind,name apiVersion".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "current".to_owned(), + "describedObject".to_owned(), + "metric".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/pods_metric_source.rs b/src/v1_30/api/autoscaling/v2/pods_metric_source.rs new file mode 100644 index 000000000..d94f92df6 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/pods_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.PodsMetricSource + +/// PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodsMetricSource { + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2::MetricTarget, +} + +impl crate::DeepMerge for PodsMetricSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodsMetricSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metric, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metric" => Field::Key_metric, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodsMetricSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodsMetricSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metric: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodsMetricSource { + metric: value_metric.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodsMetricSource", + &[ + "metric", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodsMetricSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodsMetricSource", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodsMetricSource { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.PodsMetricSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("target specifies the target value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metric".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/pods_metric_status.rs b/src/v1_30/api/autoscaling/v2/pods_metric_status.rs new file mode 100644 index 000000000..8d903c745 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/pods_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.PodsMetricStatus + +/// PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodsMetricStatus { + /// current contains the current value for the given metric + pub current: crate::api::autoscaling::v2::MetricValueStatus, + + /// metric identifies the target metric by name and selector + pub metric: crate::api::autoscaling::v2::MetricIdentifier, +} + +impl crate::DeepMerge for PodsMetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.current, other.current); + crate::DeepMerge::merge_from(&mut self.metric, other.metric); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodsMetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_current, + Key_metric, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "current" => Field::Key_current, + "metric" => Field::Key_metric, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodsMetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodsMetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_current: Option = None; + let mut value_metric: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_current => value_current = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metric => value_metric = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodsMetricStatus { + current: value_current.unwrap_or_default(), + metric: value_metric.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodsMetricStatus", + &[ + "current", + "metric", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodsMetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodsMetricStatus", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "current", &self.current)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metric", &self.metric)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodsMetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.PodsMetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "current".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current contains the current value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "metric".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metric identifies the target metric by name and selector".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "current".to_owned(), + "metric".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/resource_metric_source.rs b/src/v1_30/api/autoscaling/v2/resource_metric_source.rs new file mode 100644 index 000000000..6c5423aff --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/resource_metric_source.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ResourceMetricSource + +/// ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceMetricSource { + /// name is the name of the resource in question. + pub name: String, + + /// target specifies the target value for the given metric + pub target: crate::api::autoscaling::v2::MetricTarget, +} + +impl crate::DeepMerge for ResourceMetricSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceMetricSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceMetricSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceMetricSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceMetricSource { + name: value_name.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceMetricSource", + &[ + "name", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceMetricSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceMetricSource", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceMetricSource { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ResourceMetricSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource in question.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("target specifies the target value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/autoscaling/v2/resource_metric_status.rs b/src/v1_30/api/autoscaling/v2/resource_metric_status.rs new file mode 100644 index 000000000..692e1a234 --- /dev/null +++ b/src/v1_30/api/autoscaling/v2/resource_metric_status.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.autoscaling.v2.ResourceMetricStatus + +/// ResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceMetricStatus { + /// current contains the current value for the given metric + pub current: crate::api::autoscaling::v2::MetricValueStatus, + + /// name is the name of the resource in question. + pub name: String, +} + +impl crate::DeepMerge for ResourceMetricStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.current, other.current); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceMetricStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_current, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "current" => Field::Key_current, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceMetricStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceMetricStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_current: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_current => value_current = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceMetricStatus { + current: value_current.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceMetricStatus", + &[ + "current", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceMetricStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceMetricStatus", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "current", &self.current)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceMetricStatus { + fn schema_name() -> String { + "io.k8s.api.autoscaling.v2.ResourceMetricStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "current".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current contains the current value for the given metric".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the resource in question.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "current".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/mod.rs b/src/v1_30/api/batch/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/batch/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/batch/v1/cron_job.rs b/src/v1_30/api/batch/v1/cron_job.rs new file mode 100644 index 000000000..9836c1549 --- /dev/null +++ b/src/v1_30/api/batch/v1/cron_job.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.batch.v1.CronJob + +/// CronJob represents the configuration of a single cron job. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CronJob { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of a cron job, including the schedule. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Current status of a cron job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for CronJob { + const API_VERSION: &'static str = "batch/v1"; + const GROUP: &'static str = "batch"; + const KIND: &'static str = "CronJob"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "cronjobs"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for CronJob { + const LIST_KIND: &'static str = "CronJobList"; +} + +impl crate::Metadata for CronJob { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CronJob { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CronJob { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CronJob; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CronJob { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CronJob { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CronJob { + fn schema_name() -> String { + "io.k8s.api.batch.v1.CronJob".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CronJob represents the configuration of a single cron job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of a cron job, including the schedule. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Current status of a cron job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/cron_job_spec.rs b/src/v1_30/api/batch/v1/cron_job_spec.rs new file mode 100644 index 000000000..85f68cabc --- /dev/null +++ b/src/v1_30/api/batch/v1/cron_job_spec.rs @@ -0,0 +1,306 @@ +// Generated from definition io.k8s.api.batch.v1.CronJobSpec + +/// CronJobSpec describes how the job execution will look like and when it will actually run. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CronJobSpec { + /// Specifies how to treat concurrent executions of a Job. Valid values are: + /// + /// - "Allow" (default): allows CronJobs to run concurrently; - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; - "Replace": cancels currently running job and replaces it with a new one + pub concurrency_policy: Option, + + /// The number of failed finished jobs to retain. Value must be non-negative integer. Defaults to 1. + pub failed_jobs_history_limit: Option, + + /// Specifies the job that will be created when executing a CronJob. + pub job_template: crate::api::batch::v1::JobTemplateSpec, + + /// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + pub schedule: String, + + /// Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones. + pub starting_deadline_seconds: Option, + + /// The number of successful finished jobs to retain. Value must be non-negative integer. Defaults to 3. + pub successful_jobs_history_limit: Option, + + /// This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false. + pub suspend: Option, + + /// The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. The set of valid time zone names and the time zone offset is loaded from the system-wide time zone database by the API server during CronJob validation and the controller manager during execution. If no system-wide time zone database can be found a bundled version of the database is used instead. If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host configuration, the controller will stop creating new new Jobs and will create a system event with the reason UnknownTimeZone. More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones + pub time_zone: Option, +} + +impl crate::DeepMerge for CronJobSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.concurrency_policy, other.concurrency_policy); + crate::DeepMerge::merge_from(&mut self.failed_jobs_history_limit, other.failed_jobs_history_limit); + crate::DeepMerge::merge_from(&mut self.job_template, other.job_template); + crate::DeepMerge::merge_from(&mut self.schedule, other.schedule); + crate::DeepMerge::merge_from(&mut self.starting_deadline_seconds, other.starting_deadline_seconds); + crate::DeepMerge::merge_from(&mut self.successful_jobs_history_limit, other.successful_jobs_history_limit); + crate::DeepMerge::merge_from(&mut self.suspend, other.suspend); + crate::DeepMerge::merge_from(&mut self.time_zone, other.time_zone); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CronJobSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_concurrency_policy, + Key_failed_jobs_history_limit, + Key_job_template, + Key_schedule, + Key_starting_deadline_seconds, + Key_successful_jobs_history_limit, + Key_suspend, + Key_time_zone, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "concurrencyPolicy" => Field::Key_concurrency_policy, + "failedJobsHistoryLimit" => Field::Key_failed_jobs_history_limit, + "jobTemplate" => Field::Key_job_template, + "schedule" => Field::Key_schedule, + "startingDeadlineSeconds" => Field::Key_starting_deadline_seconds, + "successfulJobsHistoryLimit" => Field::Key_successful_jobs_history_limit, + "suspend" => Field::Key_suspend, + "timeZone" => Field::Key_time_zone, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CronJobSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CronJobSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_concurrency_policy: Option = None; + let mut value_failed_jobs_history_limit: Option = None; + let mut value_job_template: Option = None; + let mut value_schedule: Option = None; + let mut value_starting_deadline_seconds: Option = None; + let mut value_successful_jobs_history_limit: Option = None; + let mut value_suspend: Option = None; + let mut value_time_zone: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_concurrency_policy => value_concurrency_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failed_jobs_history_limit => value_failed_jobs_history_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_job_template => value_job_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_schedule => value_schedule = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_starting_deadline_seconds => value_starting_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_successful_jobs_history_limit => value_successful_jobs_history_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_suspend => value_suspend = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_time_zone => value_time_zone = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CronJobSpec { + concurrency_policy: value_concurrency_policy, + failed_jobs_history_limit: value_failed_jobs_history_limit, + job_template: value_job_template.unwrap_or_default(), + schedule: value_schedule.unwrap_or_default(), + starting_deadline_seconds: value_starting_deadline_seconds, + successful_jobs_history_limit: value_successful_jobs_history_limit, + suspend: value_suspend, + time_zone: value_time_zone, + }) + } + } + + deserializer.deserialize_struct( + "CronJobSpec", + &[ + "concurrencyPolicy", + "failedJobsHistoryLimit", + "jobTemplate", + "schedule", + "startingDeadlineSeconds", + "successfulJobsHistoryLimit", + "suspend", + "timeZone", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CronJobSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CronJobSpec", + 2 + + self.concurrency_policy.as_ref().map_or(0, |_| 1) + + self.failed_jobs_history_limit.as_ref().map_or(0, |_| 1) + + self.starting_deadline_seconds.as_ref().map_or(0, |_| 1) + + self.successful_jobs_history_limit.as_ref().map_or(0, |_| 1) + + self.suspend.as_ref().map_or(0, |_| 1) + + self.time_zone.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.concurrency_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "concurrencyPolicy", value)?; + } + if let Some(value) = &self.failed_jobs_history_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failedJobsHistoryLimit", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "jobTemplate", &self.job_template)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "schedule", &self.schedule)?; + if let Some(value) = &self.starting_deadline_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startingDeadlineSeconds", value)?; + } + if let Some(value) = &self.successful_jobs_history_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "successfulJobsHistoryLimit", value)?; + } + if let Some(value) = &self.suspend { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "suspend", value)?; + } + if let Some(value) = &self.time_zone { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeZone", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CronJobSpec { + fn schema_name() -> String { + "io.k8s.api.batch.v1.CronJobSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CronJobSpec describes how the job execution will look like and when it will actually run.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "concurrencyPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies how to treat concurrent executions of a Job. Valid values are:\n\n- \"Allow\" (default): allows CronJobs to run concurrently; - \"Forbid\": forbids concurrent runs, skipping next run if previous run hasn't finished yet; - \"Replace\": cancels currently running job and replaces it with a new one".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "failedJobsHistoryLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of failed finished jobs to retain. Value must be non-negative integer. Defaults to 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "jobTemplate".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the job that will be created when executing a CronJob.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "schedule".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "startingDeadlineSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "successfulJobsHistoryLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of successful finished jobs to retain. Value must be non-negative integer. Defaults to 3.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "suspend".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "timeZone".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. The set of valid time zone names and the time zone offset is loaded from the system-wide time zone database by the API server during CronJob validation and the controller manager during execution. If no system-wide time zone database can be found a bundled version of the database is used instead. If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host configuration, the controller will stop creating new new Jobs and will create a system event with the reason UnknownTimeZone. More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "jobTemplate".to_owned(), + "schedule".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/cron_job_status.rs b/src/v1_30/api/batch/v1/cron_job_status.rs new file mode 100644 index 000000000..c0f24458e --- /dev/null +++ b/src/v1_30/api/batch/v1/cron_job_status.rs @@ -0,0 +1,181 @@ +// Generated from definition io.k8s.api.batch.v1.CronJobStatus + +/// CronJobStatus represents the current state of a cron job. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CronJobStatus { + /// A list of pointers to currently running jobs. + pub active: Option>, + + /// Information when was the last time the job was successfully scheduled. + pub last_schedule_time: Option, + + /// Information when was the last time the job successfully completed. + pub last_successful_time: Option, +} + +impl crate::DeepMerge for CronJobStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.active, other.active); + crate::DeepMerge::merge_from(&mut self.last_schedule_time, other.last_schedule_time); + crate::DeepMerge::merge_from(&mut self.last_successful_time, other.last_successful_time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CronJobStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_active, + Key_last_schedule_time, + Key_last_successful_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "active" => Field::Key_active, + "lastScheduleTime" => Field::Key_last_schedule_time, + "lastSuccessfulTime" => Field::Key_last_successful_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CronJobStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CronJobStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_active: Option> = None; + let mut value_last_schedule_time: Option = None; + let mut value_last_successful_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_active => value_active = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_schedule_time => value_last_schedule_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_successful_time => value_last_successful_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CronJobStatus { + active: value_active, + last_schedule_time: value_last_schedule_time, + last_successful_time: value_last_successful_time, + }) + } + } + + deserializer.deserialize_struct( + "CronJobStatus", + &[ + "active", + "lastScheduleTime", + "lastSuccessfulTime", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CronJobStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CronJobStatus", + self.active.as_ref().map_or(0, |_| 1) + + self.last_schedule_time.as_ref().map_or(0, |_| 1) + + self.last_successful_time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.active { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "active", value)?; + } + if let Some(value) = &self.last_schedule_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastScheduleTime", value)?; + } + if let Some(value) = &self.last_successful_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastSuccessfulTime", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CronJobStatus { + fn schema_name() -> String { + "io.k8s.api.batch.v1.CronJobStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CronJobStatus represents the current state of a cron job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "active".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of pointers to currently running jobs.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "lastScheduleTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Information when was the last time the job was successfully scheduled.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastSuccessfulTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Information when was the last time the job successfully completed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/job.rs b/src/v1_30/api/batch/v1/job.rs new file mode 100644 index 000000000..533eebfae --- /dev/null +++ b/src/v1_30/api/batch/v1/job.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.batch.v1.Job + +/// Job represents the configuration of a single job. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Job { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Current status of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Job { + const API_VERSION: &'static str = "batch/v1"; + const GROUP: &'static str = "batch"; + const KIND: &'static str = "Job"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "jobs"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Job { + const LIST_KIND: &'static str = "JobList"; +} + +impl crate::Metadata for Job { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Job { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Job { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Job; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Job { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Job { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Job { + fn schema_name() -> String { + "io.k8s.api.batch.v1.Job".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Job represents the configuration of a single job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Current status of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/job_condition.rs b/src/v1_30/api/batch/v1/job_condition.rs new file mode 100644 index 000000000..456f2b3db --- /dev/null +++ b/src/v1_30/api/batch/v1/job_condition.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.batch.v1.JobCondition + +/// JobCondition describes current state of a job. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JobCondition { + /// Last time the condition was checked. + pub last_probe_time: Option, + + /// Last time the condition transit from one status to another. + pub last_transition_time: Option, + + /// Human readable message indicating details about last transition. + pub message: Option, + + /// (brief) reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of job condition, Complete or Failed. + pub type_: String, +} + +impl crate::DeepMerge for JobCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_probe_time, other.last_probe_time); + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JobCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_probe_time, + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastProbeTime" => Field::Key_last_probe_time, + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JobCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JobCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_probe_time: Option = None; + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_probe_time => value_last_probe_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(JobCondition { + last_probe_time: value_last_probe_time, + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "JobCondition", + &[ + "lastProbeTime", + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for JobCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "JobCondition", + 2 + + self.last_probe_time.as_ref().map_or(0, |_| 1) + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_probe_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastProbeTime", value)?; + } + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JobCondition { + fn schema_name() -> String { + "io.k8s.api.batch.v1.JobCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JobCondition describes current state of a job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastProbeTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition was checked.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transit from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Human readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("(brief) reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of job condition, Complete or Failed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/job_spec.rs b/src/v1_30/api/batch/v1/job_spec.rs new file mode 100644 index 000000000..183367620 --- /dev/null +++ b/src/v1_30/api/batch/v1/job_spec.rs @@ -0,0 +1,527 @@ +// Generated from definition io.k8s.api.batch.v1.JobSpec + +/// JobSpec describes how the job execution will look like. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JobSpec { + /// Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again. + pub active_deadline_seconds: Option, + + /// Specifies the number of retries before marking this job failed. Defaults to 6 + pub backoff_limit: Option, + + /// Specifies the limit for the number of retries within an index before marking this index as failed. When enabled the number of failures per index is kept in the pod's batch.kubernetes.io/job-index-failure-count annotation. It can only be set when Job's completionMode=Indexed, and the Pod's restart policy is Never. The field is immutable. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default). + pub backoff_limit_per_index: Option, + + /// completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`. + /// + /// `NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other. + /// + /// `Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`. + /// + /// More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job. + pub completion_mode: Option, + + /// Specifies the desired number of successfully finished pods the job should be run with. Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + pub completions: Option, + + /// ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first "/" must be a valid subdomain as defined by RFC 1123. All characters trailing the first "/" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 64 characters. + /// + /// This field is alpha-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (disabled by default). + pub managed_by: Option, + + /// manualSelector controls generation of pod labels and pod selectors. Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector + pub manual_selector: Option, + + /// Specifies the maximal number of failed indexes before marking the Job as failed, when backoffLimitPerIndex is set. Once the number of failed indexes exceeds this number the entire Job is marked as Failed and its execution is terminated. When left as null the job continues execution of all of its indexes and is marked with the `Complete` Job condition. It can only be specified when backoffLimitPerIndex is set. It can be null or up to completions. It is required and must be less than or equal to 10^4 when is completions greater than 10^5. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default). + pub max_failed_indexes: Option, + + /// Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) \< .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + pub parallelism: Option, + + /// Specifies the policy of handling failed pods. In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure. + /// + /// This field is beta-level. It can be used when the `JobPodFailurePolicy` feature gate is enabled (enabled by default). + pub pod_failure_policy: Option, + + /// podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods + /// when they are terminating (has a metadata.deletionTimestamp) or failed. + /// - Failed means to wait until a previously created Pod is fully terminated (has phase + /// Failed or Succeeded) before creating a replacement Pod. + /// + /// When using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. This is an beta field. To use this, enable the JobPodReplacementPolicy feature toggle. This is on by default. + pub pod_replacement_policy: Option, + + /// A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + pub selector: Option, + + /// successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated. + /// + /// This field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default). + pub success_policy: Option, + + /// suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false. + pub suspend: Option, + + /// Describes the pod that will be created when executing a job. The only allowed template.spec.restartPolicy values are "Never" or "OnFailure". More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + pub template: crate::api::core::v1::PodTemplateSpec, + + /// ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes. + pub ttl_seconds_after_finished: Option, +} + +impl crate::DeepMerge for JobSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.active_deadline_seconds, other.active_deadline_seconds); + crate::DeepMerge::merge_from(&mut self.backoff_limit, other.backoff_limit); + crate::DeepMerge::merge_from(&mut self.backoff_limit_per_index, other.backoff_limit_per_index); + crate::DeepMerge::merge_from(&mut self.completion_mode, other.completion_mode); + crate::DeepMerge::merge_from(&mut self.completions, other.completions); + crate::DeepMerge::merge_from(&mut self.managed_by, other.managed_by); + crate::DeepMerge::merge_from(&mut self.manual_selector, other.manual_selector); + crate::DeepMerge::merge_from(&mut self.max_failed_indexes, other.max_failed_indexes); + crate::DeepMerge::merge_from(&mut self.parallelism, other.parallelism); + crate::DeepMerge::merge_from(&mut self.pod_failure_policy, other.pod_failure_policy); + crate::DeepMerge::merge_from(&mut self.pod_replacement_policy, other.pod_replacement_policy); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.success_policy, other.success_policy); + crate::DeepMerge::merge_from(&mut self.suspend, other.suspend); + crate::DeepMerge::merge_from(&mut self.template, other.template); + crate::DeepMerge::merge_from(&mut self.ttl_seconds_after_finished, other.ttl_seconds_after_finished); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JobSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_active_deadline_seconds, + Key_backoff_limit, + Key_backoff_limit_per_index, + Key_completion_mode, + Key_completions, + Key_managed_by, + Key_manual_selector, + Key_max_failed_indexes, + Key_parallelism, + Key_pod_failure_policy, + Key_pod_replacement_policy, + Key_selector, + Key_success_policy, + Key_suspend, + Key_template, + Key_ttl_seconds_after_finished, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "activeDeadlineSeconds" => Field::Key_active_deadline_seconds, + "backoffLimit" => Field::Key_backoff_limit, + "backoffLimitPerIndex" => Field::Key_backoff_limit_per_index, + "completionMode" => Field::Key_completion_mode, + "completions" => Field::Key_completions, + "managedBy" => Field::Key_managed_by, + "manualSelector" => Field::Key_manual_selector, + "maxFailedIndexes" => Field::Key_max_failed_indexes, + "parallelism" => Field::Key_parallelism, + "podFailurePolicy" => Field::Key_pod_failure_policy, + "podReplacementPolicy" => Field::Key_pod_replacement_policy, + "selector" => Field::Key_selector, + "successPolicy" => Field::Key_success_policy, + "suspend" => Field::Key_suspend, + "template" => Field::Key_template, + "ttlSecondsAfterFinished" => Field::Key_ttl_seconds_after_finished, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JobSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JobSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_active_deadline_seconds: Option = None; + let mut value_backoff_limit: Option = None; + let mut value_backoff_limit_per_index: Option = None; + let mut value_completion_mode: Option = None; + let mut value_completions: Option = None; + let mut value_managed_by: Option = None; + let mut value_manual_selector: Option = None; + let mut value_max_failed_indexes: Option = None; + let mut value_parallelism: Option = None; + let mut value_pod_failure_policy: Option = None; + let mut value_pod_replacement_policy: Option = None; + let mut value_selector: Option = None; + let mut value_success_policy: Option = None; + let mut value_suspend: Option = None; + let mut value_template: Option = None; + let mut value_ttl_seconds_after_finished: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_active_deadline_seconds => value_active_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_backoff_limit => value_backoff_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_backoff_limit_per_index => value_backoff_limit_per_index = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_completion_mode => value_completion_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_completions => value_completions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_managed_by => value_managed_by = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_manual_selector => value_manual_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_failed_indexes => value_max_failed_indexes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parallelism => value_parallelism = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_failure_policy => value_pod_failure_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_replacement_policy => value_pod_replacement_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_success_policy => value_success_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_suspend => value_suspend = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ttl_seconds_after_finished => value_ttl_seconds_after_finished = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(JobSpec { + active_deadline_seconds: value_active_deadline_seconds, + backoff_limit: value_backoff_limit, + backoff_limit_per_index: value_backoff_limit_per_index, + completion_mode: value_completion_mode, + completions: value_completions, + managed_by: value_managed_by, + manual_selector: value_manual_selector, + max_failed_indexes: value_max_failed_indexes, + parallelism: value_parallelism, + pod_failure_policy: value_pod_failure_policy, + pod_replacement_policy: value_pod_replacement_policy, + selector: value_selector, + success_policy: value_success_policy, + suspend: value_suspend, + template: value_template.unwrap_or_default(), + ttl_seconds_after_finished: value_ttl_seconds_after_finished, + }) + } + } + + deserializer.deserialize_struct( + "JobSpec", + &[ + "activeDeadlineSeconds", + "backoffLimit", + "backoffLimitPerIndex", + "completionMode", + "completions", + "managedBy", + "manualSelector", + "maxFailedIndexes", + "parallelism", + "podFailurePolicy", + "podReplacementPolicy", + "selector", + "successPolicy", + "suspend", + "template", + "ttlSecondsAfterFinished", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for JobSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "JobSpec", + 1 + + self.active_deadline_seconds.as_ref().map_or(0, |_| 1) + + self.backoff_limit.as_ref().map_or(0, |_| 1) + + self.backoff_limit_per_index.as_ref().map_or(0, |_| 1) + + self.completion_mode.as_ref().map_or(0, |_| 1) + + self.completions.as_ref().map_or(0, |_| 1) + + self.managed_by.as_ref().map_or(0, |_| 1) + + self.manual_selector.as_ref().map_or(0, |_| 1) + + self.max_failed_indexes.as_ref().map_or(0, |_| 1) + + self.parallelism.as_ref().map_or(0, |_| 1) + + self.pod_failure_policy.as_ref().map_or(0, |_| 1) + + self.pod_replacement_policy.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1) + + self.success_policy.as_ref().map_or(0, |_| 1) + + self.suspend.as_ref().map_or(0, |_| 1) + + self.ttl_seconds_after_finished.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.active_deadline_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "activeDeadlineSeconds", value)?; + } + if let Some(value) = &self.backoff_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimit", value)?; + } + if let Some(value) = &self.backoff_limit_per_index { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backoffLimitPerIndex", value)?; + } + if let Some(value) = &self.completion_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completionMode", value)?; + } + if let Some(value) = &self.completions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completions", value)?; + } + if let Some(value) = &self.managed_by { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "managedBy", value)?; + } + if let Some(value) = &self.manual_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "manualSelector", value)?; + } + if let Some(value) = &self.max_failed_indexes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxFailedIndexes", value)?; + } + if let Some(value) = &self.parallelism { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parallelism", value)?; + } + if let Some(value) = &self.pod_failure_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podFailurePolicy", value)?; + } + if let Some(value) = &self.pod_replacement_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podReplacementPolicy", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + if let Some(value) = &self.success_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "successPolicy", value)?; + } + if let Some(value) = &self.suspend { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "suspend", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", &self.template)?; + if let Some(value) = &self.ttl_seconds_after_finished { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ttlSecondsAfterFinished", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JobSpec { + fn schema_name() -> String { + "io.k8s.api.batch.v1.JobSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JobSpec describes how the job execution will look like.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "activeDeadlineSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "backoffLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the number of retries before marking this job failed. Defaults to 6".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "backoffLimitPerIndex".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the limit for the number of retries within an index before marking this index as failed. When enabled the number of failures per index is kept in the pod's batch.kubernetes.io/job-index-failure-count annotation. It can only be set when Job's completionMode=Indexed, and the Pod's restart policy is Never. The field is immutable. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "completionMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`.\n\n`NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other.\n\n`Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`.\n\nMore completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "completions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the desired number of successfully finished pods the job should be run with. Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "managedBy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 64 characters.\n\nThis field is alpha-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (disabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "manualSelector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("manualSelector controls generation of pod labels and pod selectors. Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "maxFailedIndexes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the maximal number of failed indexes before marking the Job as failed, when backoffLimitPerIndex is set. Once the number of failed indexes exceeds this number the entire Job is marked as Failed and its execution is terminated. When left as null the job continues execution of all of its indexes and is marked with the `Complete` Job condition. It can only be specified when backoffLimitPerIndex is set. It can be null or up to completions. It is required and must be less than or equal to 10^4 when is completions greater than 10^5. This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "parallelism".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "podFailurePolicy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the policy of handling failed pods. In particular, it allows to specify the set of actions and conditions which need to be satisfied to take the associated action. If empty, the default behaviour applies - the counter of failed pods, represented by the jobs's .status.failed field, is incremented and it is checked against the backoffLimit. This field cannot be used in combination with restartPolicy=OnFailure.\n\nThis field is beta-level. It can be used when the `JobPodFailurePolicy` feature gate is enabled (enabled by default).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "podReplacementPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods\n when they are terminating (has a metadata.deletionTimestamp) or failed.\n- Failed means to wait until a previously created Pod is fully terminated (has phase\n Failed or Succeeded) before creating a replacement Pod.\n\nWhen using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use. This is an beta field. To use this, enable the JobPodReplacementPolicy feature toggle. This is on by default.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label query over pods that should match the pod count. Normally, the system sets this field for you. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "successPolicy".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("successPolicy specifies the policy when the Job can be declared as succeeded. If empty, the default behavior applies - the Job is declared as succeeded only when the number of succeeded pods equals to the completions. When the field is specified, it must be immutable and works only for the Indexed Jobs. Once the Job meets the SuccessPolicy, the lingering pods are terminated.\n\nThis field is alpha-level. To use this field, you must enable the `JobSuccessPolicy` feature gate (disabled by default).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "suspend".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes the pod that will be created when executing a job. The only allowed template.spec.restartPolicy values are \"Never\" or \"OnFailure\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "ttlSecondsAfterFinished".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "template".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/job_status.rs b/src/v1_30/api/batch/v1/job_status.rs new file mode 100644 index 000000000..b6defe411 --- /dev/null +++ b/src/v1_30/api/batch/v1/job_status.rs @@ -0,0 +1,410 @@ +// Generated from definition io.k8s.api.batch.v1.JobStatus + +/// JobStatus represents the current state of a Job. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JobStatus { + /// The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs. + pub active: Option, + + /// completedIndexes holds the completed indexes when .spec.completionMode = "Indexed" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as "1,3-5,7". + pub completed_indexes: Option, + + /// Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is set when the job finishes successfully, and only then. The value cannot be updated or removed. The value indicates the same or later point in time as the startTime field. + pub completion_time: Option, + + /// The latest available observations of an object's current state. When a Job fails, one of the conditions will have type "Failed" and status true. When a Job is suspended, one of the conditions will have type "Suspended" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type "Complete" and status true. + /// + /// A job is considered finished when it is in a terminal condition, either "Complete" or "Failed". A Job cannot have both the "Complete" and "Failed" conditions. Additionally, it cannot be in the "Complete" and "FailureTarget" conditions. The "Complete", "Failed" and "FailureTarget" conditions cannot be disabled. + /// + /// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + pub conditions: Option>, + + /// The number of pods which reached phase Failed. The value increases monotonically. + pub failed: Option, + + /// FailedIndexes holds the failed indexes when spec.backoffLimitPerIndex is set. The indexes are represented in the text format analogous as for the `completedIndexes` field, ie. they are kept as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the failed indexes are 1, 3, 4, 5 and 7, they are represented as "1,3-5,7". The set of failed indexes cannot overlap with the set of completed indexes. + /// + /// This field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default). + pub failed_indexes: Option, + + /// The number of pods which have a Ready condition. + pub ready: Option, + + /// Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC. + /// + /// Once set, the field can only be removed when the job is suspended. The field cannot be modified while the job is unsuspended or finished. + pub start_time: Option, + + /// The number of pods which reached phase Succeeded. The value increases monotonically for a given spec. However, it may decrease in reaction to scale down of elastic indexed jobs. + pub succeeded: Option, + + /// The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp). + /// + /// This field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default). + pub terminating: Option, + + /// uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters. + /// + /// The job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status: + /// + /// 1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding + /// counter. + /// + /// Old jobs might not be tracked using this field, in which case the field remains null. The structure is empty for finished jobs. + pub uncounted_terminated_pods: Option, +} + +impl crate::DeepMerge for JobStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.active, other.active); + crate::DeepMerge::merge_from(&mut self.completed_indexes, other.completed_indexes); + crate::DeepMerge::merge_from(&mut self.completion_time, other.completion_time); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.failed, other.failed); + crate::DeepMerge::merge_from(&mut self.failed_indexes, other.failed_indexes); + crate::DeepMerge::merge_from(&mut self.ready, other.ready); + crate::DeepMerge::merge_from(&mut self.start_time, other.start_time); + crate::DeepMerge::merge_from(&mut self.succeeded, other.succeeded); + crate::DeepMerge::merge_from(&mut self.terminating, other.terminating); + crate::DeepMerge::merge_from(&mut self.uncounted_terminated_pods, other.uncounted_terminated_pods); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JobStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_active, + Key_completed_indexes, + Key_completion_time, + Key_conditions, + Key_failed, + Key_failed_indexes, + Key_ready, + Key_start_time, + Key_succeeded, + Key_terminating, + Key_uncounted_terminated_pods, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "active" => Field::Key_active, + "completedIndexes" => Field::Key_completed_indexes, + "completionTime" => Field::Key_completion_time, + "conditions" => Field::Key_conditions, + "failed" => Field::Key_failed, + "failedIndexes" => Field::Key_failed_indexes, + "ready" => Field::Key_ready, + "startTime" => Field::Key_start_time, + "succeeded" => Field::Key_succeeded, + "terminating" => Field::Key_terminating, + "uncountedTerminatedPods" => Field::Key_uncounted_terminated_pods, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JobStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JobStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_active: Option = None; + let mut value_completed_indexes: Option = None; + let mut value_completion_time: Option = None; + let mut value_conditions: Option> = None; + let mut value_failed: Option = None; + let mut value_failed_indexes: Option = None; + let mut value_ready: Option = None; + let mut value_start_time: Option = None; + let mut value_succeeded: Option = None; + let mut value_terminating: Option = None; + let mut value_uncounted_terminated_pods: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_active => value_active = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_completed_indexes => value_completed_indexes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_completion_time => value_completion_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failed => value_failed = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failed_indexes => value_failed_indexes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready => value_ready = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_start_time => value_start_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_succeeded => value_succeeded = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_terminating => value_terminating = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uncounted_terminated_pods => value_uncounted_terminated_pods = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(JobStatus { + active: value_active, + completed_indexes: value_completed_indexes, + completion_time: value_completion_time, + conditions: value_conditions, + failed: value_failed, + failed_indexes: value_failed_indexes, + ready: value_ready, + start_time: value_start_time, + succeeded: value_succeeded, + terminating: value_terminating, + uncounted_terminated_pods: value_uncounted_terminated_pods, + }) + } + } + + deserializer.deserialize_struct( + "JobStatus", + &[ + "active", + "completedIndexes", + "completionTime", + "conditions", + "failed", + "failedIndexes", + "ready", + "startTime", + "succeeded", + "terminating", + "uncountedTerminatedPods", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for JobStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "JobStatus", + self.active.as_ref().map_or(0, |_| 1) + + self.completed_indexes.as_ref().map_or(0, |_| 1) + + self.completion_time.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.failed.as_ref().map_or(0, |_| 1) + + self.failed_indexes.as_ref().map_or(0, |_| 1) + + self.ready.as_ref().map_or(0, |_| 1) + + self.start_time.as_ref().map_or(0, |_| 1) + + self.succeeded.as_ref().map_or(0, |_| 1) + + self.terminating.as_ref().map_or(0, |_| 1) + + self.uncounted_terminated_pods.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.active { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "active", value)?; + } + if let Some(value) = &self.completed_indexes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completedIndexes", value)?; + } + if let Some(value) = &self.completion_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "completionTime", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.failed { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failed", value)?; + } + if let Some(value) = &self.failed_indexes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failedIndexes", value)?; + } + if let Some(value) = &self.ready { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ready", value)?; + } + if let Some(value) = &self.start_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startTime", value)?; + } + if let Some(value) = &self.succeeded { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "succeeded", value)?; + } + if let Some(value) = &self.terminating { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminating", value)?; + } + if let Some(value) = &self.uncounted_terminated_pods { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uncountedTerminatedPods", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JobStatus { + fn schema_name() -> String { + "io.k8s.api.batch.v1.JobStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JobStatus represents the current state of a Job.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "active".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "completedIndexes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("completedIndexes holds the completed indexes when .spec.completionMode = \"Indexed\" in a text format. The indexes are represented as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "completionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is set when the job finishes successfully, and only then. The value cannot be updated or removed. The value indicates the same or later point in time as the startTime field.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is in a terminal condition, either \"Complete\" or \"Failed\". A Job cannot have both the \"Complete\" and \"Failed\" conditions. Additionally, it cannot be in the \"Complete\" and \"FailureTarget\" conditions. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "failed".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods which reached phase Failed. The value increases monotonically.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "failedIndexes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FailedIndexes holds the failed indexes when spec.backoffLimitPerIndex is set. The indexes are represented in the text format analogous as for the `completedIndexes` field, ie. they are kept as decimal integers separated by commas. The numbers are listed in increasing order. Three or more consecutive numbers are compressed and represented by the first and last element of the series, separated by a hyphen. For example, if the failed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\". The set of failed indexes cannot overlap with the set of completed indexes.\n\nThis field is beta-level. It can be used when the `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ready".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods which have a Ready condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "startTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.\n\nOnce set, the field can only be removed when the job is suspended. The field cannot be modified while the job is unsuspended or finished.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "succeeded".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods which reached phase Succeeded. The value increases monotonically for a given spec. However, it may decrease in reaction to scale down of elastic indexed jobs.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "terminating".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp).\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "uncountedTerminatedPods".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status:\n\n1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nOld jobs might not be tracked using this field, in which case the field remains null. The structure is empty for finished jobs.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/job_template_spec.rs b/src/v1_30/api/batch/v1/job_template_spec.rs new file mode 100644 index 000000000..7c0d417b0 --- /dev/null +++ b/src/v1_30/api/batch/v1/job_template_spec.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.batch.v1.JobTemplateSpec + +/// JobTemplateSpec describes the data a Job should have when created from a template +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JobTemplateSpec { + /// Standard object's metadata of the jobs created from this template. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: Option, + + /// Specification of the desired behavior of the job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::DeepMerge for JobTemplateSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JobTemplateSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JobTemplateSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JobTemplateSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(JobTemplateSpec { + metadata: value_metadata, + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + "JobTemplateSpec", + &[ + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for JobTemplateSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "JobTemplateSpec", + self.metadata.as_ref().map_or(0, |_| 1) + + self.spec.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.metadata { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", value)?; + } + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JobTemplateSpec { + fn schema_name() -> String { + "io.k8s.api.batch.v1.JobTemplateSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JobTemplateSpec describes the data a Job should have when created from a template".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata of the jobs created from this template. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/mod.rs b/src/v1_30/api/batch/v1/mod.rs new file mode 100644 index 000000000..8ba56c888 --- /dev/null +++ b/src/v1_30/api/batch/v1/mod.rs @@ -0,0 +1,45 @@ + +mod cron_job; +pub use self::cron_job::CronJob; + +mod cron_job_spec; +pub use self::cron_job_spec::CronJobSpec; + +mod cron_job_status; +pub use self::cron_job_status::CronJobStatus; + +mod job; +pub use self::job::Job; + +mod job_condition; +pub use self::job_condition::JobCondition; + +mod job_spec; +pub use self::job_spec::JobSpec; + +mod job_status; +pub use self::job_status::JobStatus; + +mod job_template_spec; +pub use self::job_template_spec::JobTemplateSpec; + +mod pod_failure_policy; +pub use self::pod_failure_policy::PodFailurePolicy; + +mod pod_failure_policy_on_exit_codes_requirement; +pub use self::pod_failure_policy_on_exit_codes_requirement::PodFailurePolicyOnExitCodesRequirement; + +mod pod_failure_policy_on_pod_conditions_pattern; +pub use self::pod_failure_policy_on_pod_conditions_pattern::PodFailurePolicyOnPodConditionsPattern; + +mod pod_failure_policy_rule; +pub use self::pod_failure_policy_rule::PodFailurePolicyRule; + +mod success_policy; +pub use self::success_policy::SuccessPolicy; + +mod success_policy_rule; +pub use self::success_policy_rule::SuccessPolicyRule; + +mod uncounted_terminated_pods; +pub use self::uncounted_terminated_pods::UncountedTerminatedPods; diff --git a/src/v1_30/api/batch/v1/pod_failure_policy.rs b/src/v1_30/api/batch/v1/pod_failure_policy.rs new file mode 100644 index 000000000..976e6077e --- /dev/null +++ b/src/v1_30/api/batch/v1/pod_failure_policy.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.batch.v1.PodFailurePolicy + +/// PodFailurePolicy describes how failed pods influence the backoffLimit. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodFailurePolicy { + /// A list of pod failure policy rules. The rules are evaluated in order. Once a rule matches a Pod failure, the remaining of the rules are ignored. When no rule matches the Pod failure, the default handling applies - the counter of pod failures is incremented and it is checked against the backoffLimit. At most 20 elements are allowed. + pub rules: Vec, +} + +impl crate::DeepMerge for PodFailurePolicy { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodFailurePolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodFailurePolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodFailurePolicy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodFailurePolicy { + rules: value_rules.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodFailurePolicy", + &[ + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodFailurePolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodFailurePolicy", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", &self.rules)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodFailurePolicy { + fn schema_name() -> String { + "io.k8s.api.batch.v1.PodFailurePolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodFailurePolicy describes how failed pods influence the backoffLimit.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of pod failure policy rules. The rules are evaluated in order. Once a rule matches a Pod failure, the remaining of the rules are ignored. When no rule matches the Pod failure, the default handling applies - the counter of pod failures is incremented and it is checked against the backoffLimit. At most 20 elements are allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "rules".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs b/src/v1_30/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs new file mode 100644 index 000000000..da63db707 --- /dev/null +++ b/src/v1_30/api/batch/v1/pod_failure_policy_on_exit_codes_requirement.rs @@ -0,0 +1,194 @@ +// Generated from definition io.k8s.api.batch.v1.PodFailurePolicyOnExitCodesRequirement + +/// PodFailurePolicyOnExitCodesRequirement describes the requirement for handling a failed pod based on its container exit codes. In particular, it lookups the .state.terminated.exitCode for each app container and init container status, represented by the .status.containerStatuses and .status.initContainerStatuses fields in the Pod status, respectively. Containers completed with success (exit code 0) are excluded from the requirement check. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodFailurePolicyOnExitCodesRequirement { + /// Restricts the check for exit codes to the container with the specified name. When null, the rule applies to all containers. When specified, it should match one the container or initContainer names in the pod template. + pub container_name: Option, + + /// Represents the relationship between the container exit code(s) and the specified values. Containers completed with success (exit code 0) are excluded from the requirement check. Possible values are: + /// + /// - In: the requirement is satisfied if at least one container exit code + /// (might be multiple if there are multiple containers not restricted + /// by the 'containerName' field) is in the set of specified values. + /// - NotIn: the requirement is satisfied if at least one container exit code + /// (might be multiple if there are multiple containers not restricted + /// by the 'containerName' field) is not in the set of specified values. + /// Additional values are considered to be added in the future. Clients should react to an unknown operator by assuming the requirement is not satisfied. + pub operator: String, + + /// Specifies the set of values. Each returned container exit code (might be multiple in case of multiple containers) is checked against this set of values with respect to the operator. The list of values must be ordered and must not contain duplicates. Value '0' cannot be used for the In operator. At least one element is required. At most 255 elements are allowed. + pub values: Vec, +} + +impl crate::DeepMerge for PodFailurePolicyOnExitCodesRequirement { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_name, other.container_name); + crate::DeepMerge::merge_from(&mut self.operator, other.operator); + crate::merge_strategies::list::set(&mut self.values, other.values); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodFailurePolicyOnExitCodesRequirement { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_name, + Key_operator, + Key_values, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerName" => Field::Key_container_name, + "operator" => Field::Key_operator, + "values" => Field::Key_values, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodFailurePolicyOnExitCodesRequirement; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodFailurePolicyOnExitCodesRequirement") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_name: Option = None; + let mut value_operator: Option = None; + let mut value_values: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_name => value_container_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operator => value_operator = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_values => value_values = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodFailurePolicyOnExitCodesRequirement { + container_name: value_container_name, + operator: value_operator.unwrap_or_default(), + values: value_values.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodFailurePolicyOnExitCodesRequirement", + &[ + "containerName", + "operator", + "values", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodFailurePolicyOnExitCodesRequirement { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodFailurePolicyOnExitCodesRequirement", + 2 + + self.container_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.container_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operator", &self.operator)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "values", &self.values)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodFailurePolicyOnExitCodesRequirement { + fn schema_name() -> String { + "io.k8s.api.batch.v1.PodFailurePolicyOnExitCodesRequirement".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodFailurePolicyOnExitCodesRequirement describes the requirement for handling a failed pod based on its container exit codes. In particular, it lookups the .state.terminated.exitCode for each app container and init container status, represented by the .status.containerStatuses and .status.initContainerStatuses fields in the Pod status, respectively. Containers completed with success (exit code 0) are excluded from the requirement check.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Restricts the check for exit codes to the container with the specified name. When null, the rule applies to all containers. When specified, it should match one the container or initContainer names in the pod template.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operator".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the relationship between the container exit code(s) and the specified values. Containers completed with success (exit code 0) are excluded from the requirement check. Possible values are:\n\n- In: the requirement is satisfied if at least one container exit code\n (might be multiple if there are multiple containers not restricted\n by the 'containerName' field) is in the set of specified values.\n- NotIn: the requirement is satisfied if at least one container exit code\n (might be multiple if there are multiple containers not restricted\n by the 'containerName' field) is not in the set of specified values.\nAdditional values are considered to be added in the future. Clients should react to an unknown operator by assuming the requirement is not satisfied.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "values".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the set of values. Each returned container exit code (might be multiple in case of multiple containers) is checked against this set of values with respect to the operator. The list of values must be ordered and must not contain duplicates. Value '0' cannot be used for the In operator. At least one element is required. At most 255 elements are allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "operator".to_owned(), + "values".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/pod_failure_policy_on_pod_conditions_pattern.rs b/src/v1_30/api/batch/v1/pod_failure_policy_on_pod_conditions_pattern.rs new file mode 100644 index 000000000..67e4ecb70 --- /dev/null +++ b/src/v1_30/api/batch/v1/pod_failure_policy_on_pod_conditions_pattern.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.batch.v1.PodFailurePolicyOnPodConditionsPattern + +/// PodFailurePolicyOnPodConditionsPattern describes a pattern for matching an actual pod condition type. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodFailurePolicyOnPodConditionsPattern { + /// Specifies the required Pod condition status. To match a pod condition it is required that the specified status equals the pod condition status. Defaults to True. + pub status: String, + + /// Specifies the required Pod condition type. To match a pod condition it is required that specified type equals the pod condition type. + pub type_: String, +} + +impl crate::DeepMerge for PodFailurePolicyOnPodConditionsPattern { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodFailurePolicyOnPodConditionsPattern { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodFailurePolicyOnPodConditionsPattern; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodFailurePolicyOnPodConditionsPattern") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodFailurePolicyOnPodConditionsPattern { + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodFailurePolicyOnPodConditionsPattern", + &[ + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodFailurePolicyOnPodConditionsPattern { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodFailurePolicyOnPodConditionsPattern", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodFailurePolicyOnPodConditionsPattern { + fn schema_name() -> String { + "io.k8s.api.batch.v1.PodFailurePolicyOnPodConditionsPattern".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodFailurePolicyOnPodConditionsPattern describes a pattern for matching an actual pod condition type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the required Pod condition status. To match a pod condition it is required that the specified status equals the pod condition status. Defaults to True.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the required Pod condition type. To match a pod condition it is required that specified type equals the pod condition type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/pod_failure_policy_rule.rs b/src/v1_30/api/batch/v1/pod_failure_policy_rule.rs new file mode 100644 index 000000000..a890d9d4b --- /dev/null +++ b/src/v1_30/api/batch/v1/pod_failure_policy_rule.rs @@ -0,0 +1,194 @@ +// Generated from definition io.k8s.api.batch.v1.PodFailurePolicyRule + +/// PodFailurePolicyRule describes how a pod failure is handled when the requirements are met. One of onExitCodes and onPodConditions, but not both, can be used in each rule. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodFailurePolicyRule { + /// Specifies the action taken on a pod failure when the requirements are satisfied. Possible values are: + /// + /// - FailJob: indicates that the pod's job is marked as Failed and all + /// running pods are terminated. + /// - FailIndex: indicates that the pod's index is marked as Failed and will + /// not be restarted. + /// This value is beta-level. It can be used when the + /// `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default). + /// - Ignore: indicates that the counter towards the .backoffLimit is not + /// incremented and a replacement pod is created. + /// - Count: indicates that the pod is handled in the default way - the + /// counter towards the .backoffLimit is incremented. + /// Additional values are considered to be added in the future. Clients should react to an unknown action by skipping the rule. + pub action: String, + + /// Represents the requirement on the container exit codes. + pub on_exit_codes: Option, + + /// Represents the requirement on the pod conditions. The requirement is represented as a list of pod condition patterns. The requirement is satisfied if at least one pattern matches an actual pod condition. At most 20 elements are allowed. + pub on_pod_conditions: Option>, +} + +impl crate::DeepMerge for PodFailurePolicyRule { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.action, other.action); + crate::DeepMerge::merge_from(&mut self.on_exit_codes, other.on_exit_codes); + crate::merge_strategies::list::atomic(&mut self.on_pod_conditions, other.on_pod_conditions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodFailurePolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_action, + Key_on_exit_codes, + Key_on_pod_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "action" => Field::Key_action, + "onExitCodes" => Field::Key_on_exit_codes, + "onPodConditions" => Field::Key_on_pod_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodFailurePolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodFailurePolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_action: Option = None; + let mut value_on_exit_codes: Option = None; + let mut value_on_pod_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_action => value_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_on_exit_codes => value_on_exit_codes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_on_pod_conditions => value_on_pod_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodFailurePolicyRule { + action: value_action.unwrap_or_default(), + on_exit_codes: value_on_exit_codes, + on_pod_conditions: value_on_pod_conditions, + }) + } + } + + deserializer.deserialize_struct( + "PodFailurePolicyRule", + &[ + "action", + "onExitCodes", + "onPodConditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodFailurePolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodFailurePolicyRule", + 1 + + self.on_exit_codes.as_ref().map_or(0, |_| 1) + + self.on_pod_conditions.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "action", &self.action)?; + if let Some(value) = &self.on_exit_codes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "onExitCodes", value)?; + } + if let Some(value) = &self.on_pod_conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "onPodConditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodFailurePolicyRule { + fn schema_name() -> String { + "io.k8s.api.batch.v1.PodFailurePolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodFailurePolicyRule describes how a pod failure is handled when the requirements are met. One of onExitCodes and onPodConditions, but not both, can be used in each rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "action".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the action taken on a pod failure when the requirements are satisfied. Possible values are:\n\n- FailJob: indicates that the pod's job is marked as Failed and all\n running pods are terminated.\n- FailIndex: indicates that the pod's index is marked as Failed and will\n not be restarted.\n This value is beta-level. It can be used when the\n `JobBackoffLimitPerIndex` feature gate is enabled (enabled by default).\n- Ignore: indicates that the counter towards the .backoffLimit is not\n incremented and a replacement pod is created.\n- Count: indicates that the pod is handled in the default way - the\n counter towards the .backoffLimit is incremented.\nAdditional values are considered to be added in the future. Clients should react to an unknown action by skipping the rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "onExitCodes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the requirement on the container exit codes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "onPodConditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the requirement on the pod conditions. The requirement is represented as a list of pod condition patterns. The requirement is satisfied if at least one pattern matches an actual pod condition. At most 20 elements are allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "action".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/success_policy.rs b/src/v1_30/api/batch/v1/success_policy.rs new file mode 100644 index 000000000..d9aff33b3 --- /dev/null +++ b/src/v1_30/api/batch/v1/success_policy.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.batch.v1.SuccessPolicy + +/// SuccessPolicy describes when a Job can be declared as succeeded based on the success of some indexes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SuccessPolicy { + /// rules represents the list of alternative rules for the declaring the Jobs as successful before `.status.succeeded \>= .spec.completions`. Once any of the rules are met, the "SucceededCriteriaMet" condition is added, and the lingering pods are removed. The terminal state for such a Job has the "Complete" condition. Additionally, these rules are evaluated in order; Once the Job meets one of the rules, other rules are ignored. At most 20 elements are allowed. + pub rules: Vec, +} + +impl crate::DeepMerge for SuccessPolicy { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SuccessPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SuccessPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SuccessPolicy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SuccessPolicy { + rules: value_rules.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "SuccessPolicy", + &[ + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SuccessPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SuccessPolicy", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", &self.rules)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SuccessPolicy { + fn schema_name() -> String { + "io.k8s.api.batch.v1.SuccessPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SuccessPolicy describes when a Job can be declared as succeeded based on the success of some indexes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("rules represents the list of alternative rules for the declaring the Jobs as successful before `.status.succeeded >= .spec.completions`. Once any of the rules are met, the \"SucceededCriteriaMet\" condition is added, and the lingering pods are removed. The terminal state for such a Job has the \"Complete\" condition. Additionally, these rules are evaluated in order; Once the Job meets one of the rules, other rules are ignored. At most 20 elements are allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "rules".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/success_policy_rule.rs b/src/v1_30/api/batch/v1/success_policy_rule.rs new file mode 100644 index 000000000..e2547e713 --- /dev/null +++ b/src/v1_30/api/batch/v1/success_policy_rule.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.batch.v1.SuccessPolicyRule + +/// SuccessPolicyRule describes rule for declaring a Job as succeeded. Each rule must have at least one of the "succeededIndexes" or "succeededCount" specified. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SuccessPolicyRule { + /// succeededCount specifies the minimal required size of the actual set of the succeeded indexes for the Job. When succeededCount is used along with succeededIndexes, the check is constrained only to the set of indexes specified by succeededIndexes. For example, given that succeededIndexes is "1-4", succeededCount is "3", and completed indexes are "1", "3", and "5", the Job isn't declared as succeeded because only "1" and "3" indexes are considered in that rules. When this field is null, this doesn't default to any value and is never evaluated at any time. When specified it needs to be a positive integer. + pub succeeded_count: Option, + + /// succeededIndexes specifies the set of indexes which need to be contained in the actual set of the succeeded indexes for the Job. The list of indexes must be within 0 to ".spec.completions-1" and must not contain duplicates. At least one element is required. The indexes are represented as intervals separated by commas. The intervals can be a decimal integer or a pair of decimal integers separated by a hyphen. The number are listed in represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as "1,3-5,7". When this field is null, this field doesn't default to any value and is never evaluated at any time. + pub succeeded_indexes: Option, +} + +impl crate::DeepMerge for SuccessPolicyRule { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.succeeded_count, other.succeeded_count); + crate::DeepMerge::merge_from(&mut self.succeeded_indexes, other.succeeded_indexes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SuccessPolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_succeeded_count, + Key_succeeded_indexes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "succeededCount" => Field::Key_succeeded_count, + "succeededIndexes" => Field::Key_succeeded_indexes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SuccessPolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SuccessPolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_succeeded_count: Option = None; + let mut value_succeeded_indexes: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_succeeded_count => value_succeeded_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_succeeded_indexes => value_succeeded_indexes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SuccessPolicyRule { + succeeded_count: value_succeeded_count, + succeeded_indexes: value_succeeded_indexes, + }) + } + } + + deserializer.deserialize_struct( + "SuccessPolicyRule", + &[ + "succeededCount", + "succeededIndexes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SuccessPolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SuccessPolicyRule", + self.succeeded_count.as_ref().map_or(0, |_| 1) + + self.succeeded_indexes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.succeeded_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "succeededCount", value)?; + } + if let Some(value) = &self.succeeded_indexes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "succeededIndexes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SuccessPolicyRule { + fn schema_name() -> String { + "io.k8s.api.batch.v1.SuccessPolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SuccessPolicyRule describes rule for declaring a Job as succeeded. Each rule must have at least one of the \"succeededIndexes\" or \"succeededCount\" specified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "succeededCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("succeededCount specifies the minimal required size of the actual set of the succeeded indexes for the Job. When succeededCount is used along with succeededIndexes, the check is constrained only to the set of indexes specified by succeededIndexes. For example, given that succeededIndexes is \"1-4\", succeededCount is \"3\", and completed indexes are \"1\", \"3\", and \"5\", the Job isn't declared as succeeded because only \"1\" and \"3\" indexes are considered in that rules. When this field is null, this doesn't default to any value and is never evaluated at any time. When specified it needs to be a positive integer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "succeededIndexes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("succeededIndexes specifies the set of indexes which need to be contained in the actual set of the succeeded indexes for the Job. The list of indexes must be within 0 to \".spec.completions-1\" and must not contain duplicates. At least one element is required. The indexes are represented as intervals separated by commas. The intervals can be a decimal integer or a pair of decimal integers separated by a hyphen. The number are listed in represented by the first and last element of the series, separated by a hyphen. For example, if the completed indexes are 1, 3, 4, 5 and 7, they are represented as \"1,3-5,7\". When this field is null, this field doesn't default to any value and is never evaluated at any time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/batch/v1/uncounted_terminated_pods.rs b/src/v1_30/api/batch/v1/uncounted_terminated_pods.rs new file mode 100644 index 000000000..b8d526d15 --- /dev/null +++ b/src/v1_30/api/batch/v1/uncounted_terminated_pods.rs @@ -0,0 +1,170 @@ +// Generated from definition io.k8s.api.batch.v1.UncountedTerminatedPods + +/// UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't been accounted in Job status counters. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct UncountedTerminatedPods { + /// failed holds UIDs of failed Pods. + pub failed: Option>, + + /// succeeded holds UIDs of succeeded Pods. + pub succeeded: Option>, +} + +impl crate::DeepMerge for UncountedTerminatedPods { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.failed, other.failed); + crate::merge_strategies::list::set(&mut self.succeeded, other.succeeded); + } +} + +impl<'de> crate::serde::Deserialize<'de> for UncountedTerminatedPods { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_failed, + Key_succeeded, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "failed" => Field::Key_failed, + "succeeded" => Field::Key_succeeded, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = UncountedTerminatedPods; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("UncountedTerminatedPods") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_failed: Option> = None; + let mut value_succeeded: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_failed => value_failed = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_succeeded => value_succeeded = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(UncountedTerminatedPods { + failed: value_failed, + succeeded: value_succeeded, + }) + } + } + + deserializer.deserialize_struct( + "UncountedTerminatedPods", + &[ + "failed", + "succeeded", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for UncountedTerminatedPods { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "UncountedTerminatedPods", + self.failed.as_ref().map_or(0, |_| 1) + + self.succeeded.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.failed { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failed", value)?; + } + if let Some(value) = &self.succeeded { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "succeeded", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for UncountedTerminatedPods { + fn schema_name() -> String { + "io.k8s.api.batch.v1.UncountedTerminatedPods".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UncountedTerminatedPods holds UIDs of Pods that have terminated but haven't been accounted in Job status counters.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "failed".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("failed holds UIDs of failed Pods.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "succeeded".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("succeeded holds UIDs of succeeded Pods.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/mod.rs b/src/v1_30/api/certificates/mod.rs new file mode 100644 index 000000000..eddcfcf9e --- /dev/null +++ b/src/v1_30/api/certificates/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1alpha1; diff --git a/src/v1_30/api/certificates/v1/certificate_signing_request.rs b/src/v1_30/api/certificates/v1/certificate_signing_request.rs new file mode 100644 index 000000000..c2bdd59ab --- /dev/null +++ b/src/v1_30/api/certificates/v1/certificate_signing_request.rs @@ -0,0 +1,241 @@ +// Generated from definition io.k8s.api.certificates.v1.CertificateSigningRequest + +/// CertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued. +/// +/// Kubelets use this API to obtain: +/// 1. client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client-kubelet" signerName). +/// 2. serving certificates for TLS endpoints kube-apiserver can connect to securely (with the "kubernetes.io/kubelet-serving" signerName). +/// +/// This API can be used to request client certificates to authenticate to kube-apiserver (with the "kubernetes.io/kube-apiserver-client" signerName), or to obtain certificates from custom non-Kubernetes signers. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CertificateSigningRequest { + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec contains the certificate request, and is immutable after creation. Only the request, signerName, expirationSeconds, and usages fields can be set on creation. Other fields are derived by Kubernetes and cannot be modified by users. + pub spec: crate::api::certificates::v1::CertificateSigningRequestSpec, + + /// status contains information about whether the request is approved or denied, and the certificate issued by the signer, or the failure condition indicating signer failure. + pub status: Option, +} + +impl crate::Resource for CertificateSigningRequest { + const API_VERSION: &'static str = "certificates.k8s.io/v1"; + const GROUP: &'static str = "certificates.k8s.io"; + const KIND: &'static str = "CertificateSigningRequest"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "certificatesigningrequests"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for CertificateSigningRequest { + const LIST_KIND: &'static str = "CertificateSigningRequestList"; +} + +impl crate::Metadata for CertificateSigningRequest { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CertificateSigningRequest { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CertificateSigningRequest { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CertificateSigningRequest; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CertificateSigningRequest { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CertificateSigningRequest { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CertificateSigningRequest { + fn schema_name() -> String { + "io.k8s.api.certificates.v1.CertificateSigningRequest".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued.\n\nKubelets use this API to obtain:\n 1. client certificates to authenticate to kube-apiserver (with the \"kubernetes.io/kube-apiserver-client-kubelet\" signerName).\n 2. serving certificates for TLS endpoints kube-apiserver can connect to securely (with the \"kubernetes.io/kubelet-serving\" signerName).\n\nThis API can be used to request client certificates to authenticate to kube-apiserver (with the \"kubernetes.io/kube-apiserver-client\" signerName), or to obtain certificates from custom non-Kubernetes signers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + __gen.subschema_for::(), + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec contains the certificate request, and is immutable after creation. Only the request, signerName, expirationSeconds, and usages fields can be set on creation. Other fields are derived by Kubernetes and cannot be modified by users.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status contains information about whether the request is approved or denied, and the certificate issued by the signer, or the failure condition indicating signer failure.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1/certificate_signing_request_condition.rs b/src/v1_30/api/certificates/v1/certificate_signing_request_condition.rs new file mode 100644 index 000000000..81202d66d --- /dev/null +++ b/src/v1_30/api/certificates/v1/certificate_signing_request_condition.rs @@ -0,0 +1,261 @@ +// Generated from definition io.k8s.api.certificates.v1.CertificateSigningRequestCondition + +/// CertificateSigningRequestCondition describes a condition of a CertificateSigningRequest object +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CertificateSigningRequestCondition { + /// lastTransitionTime is the time the condition last transitioned from one status to another. If unset, when a new condition type is added or an existing condition's status is changed, the server defaults this to the current time. + pub last_transition_time: Option, + + /// lastUpdateTime is the time of the last update to this condition + pub last_update_time: Option, + + /// message contains a human readable message with details about the request state + pub message: Option, + + /// reason indicates a brief reason for the request state + pub reason: Option, + + /// status of the condition, one of True, False, Unknown. Approved, Denied, and Failed conditions may not be "False" or "Unknown". + pub status: String, + + /// type of the condition. Known conditions are "Approved", "Denied", and "Failed". + /// + /// An "Approved" condition is added via the /approval subresource, indicating the request was approved and should be issued by the signer. + /// + /// A "Denied" condition is added via the /approval subresource, indicating the request was denied and should not be issued by the signer. + /// + /// A "Failed" condition is added via the /status subresource, indicating the signer failed to issue the certificate. + /// + /// Approved and Denied conditions are mutually exclusive. Approved, Denied, and Failed conditions cannot be removed once added. + /// + /// Only one condition of a given type is allowed. + pub type_: String, +} + +impl crate::DeepMerge for CertificateSigningRequestCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.last_update_time, other.last_update_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CertificateSigningRequestCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_last_update_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "lastUpdateTime" => Field::Key_last_update_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CertificateSigningRequestCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CertificateSigningRequestCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_last_update_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_update_time => value_last_update_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CertificateSigningRequestCondition { + last_transition_time: value_last_transition_time, + last_update_time: value_last_update_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CertificateSigningRequestCondition", + &[ + "lastTransitionTime", + "lastUpdateTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CertificateSigningRequestCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CertificateSigningRequestCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.last_update_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.last_update_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastUpdateTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CertificateSigningRequestCondition { + fn schema_name() -> String { + "io.k8s.api.certificates.v1.CertificateSigningRequestCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CertificateSigningRequestCondition describes a condition of a CertificateSigningRequest object".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastTransitionTime is the time the condition last transitioned from one status to another. If unset, when a new condition type is added or an existing condition's status is changed, the server defaults this to the current time.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastUpdateTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastUpdateTime is the time of the last update to this condition".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message contains a human readable message with details about the request state".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason indicates a brief reason for the request state".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status of the condition, one of True, False, Unknown. Approved, Denied, and Failed conditions may not be \"False\" or \"Unknown\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type of the condition. Known conditions are \"Approved\", \"Denied\", and \"Failed\".\n\nAn \"Approved\" condition is added via the /approval subresource, indicating the request was approved and should be issued by the signer.\n\nA \"Denied\" condition is added via the /approval subresource, indicating the request was denied and should not be issued by the signer.\n\nA \"Failed\" condition is added via the /status subresource, indicating the signer failed to issue the certificate.\n\nApproved and Denied conditions are mutually exclusive. Approved, Denied, and Failed conditions cannot be removed once added.\n\nOnly one condition of a given type is allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1/certificate_signing_request_spec.rs b/src/v1_30/api/certificates/v1/certificate_signing_request_spec.rs new file mode 100644 index 000000000..36248828f --- /dev/null +++ b/src/v1_30/api/certificates/v1/certificate_signing_request_spec.rs @@ -0,0 +1,385 @@ +// Generated from definition io.k8s.api.certificates.v1.CertificateSigningRequestSpec + +/// CertificateSigningRequestSpec contains the certificate request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CertificateSigningRequestSpec { + /// expirationSeconds is the requested duration of validity of the issued certificate. The certificate signer may issue a certificate with a different validity duration so a client must check the delta between the notBefore and and notAfter fields in the issued certificate to determine the actual duration. + /// + /// The v1.22+ in-tree implementations of the well-known Kubernetes signers will honor this field as long as the requested duration is not greater than the maximum duration they will honor per the --cluster-signing-duration CLI flag to the Kubernetes controller manager. + /// + /// Certificate signers may not honor this field for various reasons: + /// + /// 1. Old signer that is unaware of the field (such as the in-tree + /// implementations prior to v1.22) + /// 2. Signer whose configured maximum is shorter than the requested duration + /// 3. Signer whose configured minimum is longer than the requested duration + /// + /// The minimum valid value for expirationSeconds is 600, i.e. 10 minutes. + pub expiration_seconds: Option, + + /// extra contains extra attributes of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. + pub extra: Option>>, + + /// groups contains group membership of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. + pub groups: Option>, + + /// request contains an x509 certificate signing request encoded in a "CERTIFICATE REQUEST" PEM block. When serialized as JSON or YAML, the data is additionally base64-encoded. + pub request: crate::ByteString, + + /// signerName indicates the requested signer, and is a qualified name. + /// + /// List/watch requests for CertificateSigningRequests can filter on this field using a "spec.signerName=NAME" fieldSelector. + /// + /// Well-known Kubernetes signers are: + /// 1. "kubernetes.io/kube-apiserver-client": issues client certificates that can be used to authenticate to kube-apiserver. + /// Requests for this signer are never auto-approved by kube-controller-manager, can be issued by the "csrsigning" controller in kube-controller-manager. + /// 2. "kubernetes.io/kube-apiserver-client-kubelet": issues client certificates that kubelets use to authenticate to kube-apiserver. + /// Requests for this signer can be auto-approved by the "csrapproving" controller in kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + /// 3. "kubernetes.io/kubelet-serving" issues serving certificates that kubelets use to serve TLS endpoints, which kube-apiserver can connect to securely. + /// Requests for this signer are never auto-approved by kube-controller-manager, and can be issued by the "csrsigning" controller in kube-controller-manager. + /// + /// More details are available at https://k8s.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers + /// + /// Custom signerNames can also be specified. The signer defines: + /// 1. Trust distribution: how trust (CA bundles) are distributed. + /// 2. Permitted subjects: and behavior when a disallowed subject is requested. + /// 3. Required, permitted, or forbidden x509 extensions in the request (including whether subjectAltNames are allowed, which types, restrictions on allowed values) and behavior when a disallowed extension is requested. + /// 4. Required, permitted, or forbidden key usages / extended key usages. + /// 5. Expiration/certificate lifetime: whether it is fixed by the signer, configurable by the admin. + /// 6. Whether or not requests for CA certificates are allowed. + pub signer_name: String, + + /// uid contains the uid of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. + pub uid: Option, + + /// usages specifies a set of key usages requested in the issued certificate. + /// + /// Requests for TLS client certificates typically request: "digital signature", "key encipherment", "client auth". + /// + /// Requests for TLS serving certificates typically request: "key encipherment", "digital signature", "server auth". + /// + /// Valid values are: + /// "signing", "digital signature", "content commitment", + /// "key encipherment", "key agreement", "data encipherment", + /// "cert sign", "crl sign", "encipher only", "decipher only", "any", + /// "server auth", "client auth", + /// "code signing", "email protection", "s/mime", + /// "ipsec end system", "ipsec tunnel", "ipsec user", + /// "timestamping", "ocsp signing", "microsoft sgc", "netscape sgc" + pub usages: Option>, + + /// username contains the name of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable. + pub username: Option, +} + +impl crate::DeepMerge for CertificateSigningRequestSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.expiration_seconds, other.expiration_seconds); + crate::merge_strategies::map::granular(&mut self.extra, other.extra, |current_item, other_item| { + crate::merge_strategies::list::atomic(current_item, other_item); + }); + crate::merge_strategies::list::atomic(&mut self.groups, other.groups); + crate::DeepMerge::merge_from(&mut self.request, other.request); + crate::DeepMerge::merge_from(&mut self.signer_name, other.signer_name); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + crate::merge_strategies::list::atomic(&mut self.usages, other.usages); + crate::DeepMerge::merge_from(&mut self.username, other.username); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CertificateSigningRequestSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_expiration_seconds, + Key_extra, + Key_groups, + Key_request, + Key_signer_name, + Key_uid, + Key_usages, + Key_username, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "expirationSeconds" => Field::Key_expiration_seconds, + "extra" => Field::Key_extra, + "groups" => Field::Key_groups, + "request" => Field::Key_request, + "signerName" => Field::Key_signer_name, + "uid" => Field::Key_uid, + "usages" => Field::Key_usages, + "username" => Field::Key_username, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CertificateSigningRequestSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CertificateSigningRequestSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_expiration_seconds: Option = None; + let mut value_extra: Option>> = None; + let mut value_groups: Option> = None; + let mut value_request: Option = None; + let mut value_signer_name: Option = None; + let mut value_uid: Option = None; + let mut value_usages: Option> = None; + let mut value_username: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_expiration_seconds => value_expiration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_extra => value_extra = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_groups => value_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_request => value_request = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_signer_name => value_signer_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_usages => value_usages = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_username => value_username = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CertificateSigningRequestSpec { + expiration_seconds: value_expiration_seconds, + extra: value_extra, + groups: value_groups, + request: value_request.unwrap_or_default(), + signer_name: value_signer_name.unwrap_or_default(), + uid: value_uid, + usages: value_usages, + username: value_username, + }) + } + } + + deserializer.deserialize_struct( + "CertificateSigningRequestSpec", + &[ + "expirationSeconds", + "extra", + "groups", + "request", + "signerName", + "uid", + "usages", + "username", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CertificateSigningRequestSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CertificateSigningRequestSpec", + 2 + + self.expiration_seconds.as_ref().map_or(0, |_| 1) + + self.extra.as_ref().map_or(0, |_| 1) + + self.groups.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1) + + self.usages.as_ref().map_or(0, |_| 1) + + self.username.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.expiration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expirationSeconds", value)?; + } + if let Some(value) = &self.extra { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "extra", value)?; + } + if let Some(value) = &self.groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groups", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "request", &self.request)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "signerName", &self.signer_name)?; + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + if let Some(value) = &self.usages { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "usages", value)?; + } + if let Some(value) = &self.username { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "username", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CertificateSigningRequestSpec { + fn schema_name() -> String { + "io.k8s.api.certificates.v1.CertificateSigningRequestSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CertificateSigningRequestSpec contains the certificate request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "expirationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("expirationSeconds is the requested duration of validity of the issued certificate. The certificate signer may issue a certificate with a different validity duration so a client must check the delta between the notBefore and and notAfter fields in the issued certificate to determine the actual duration.\n\nThe v1.22+ in-tree implementations of the well-known Kubernetes signers will honor this field as long as the requested duration is not greater than the maximum duration they will honor per the --cluster-signing-duration CLI flag to the Kubernetes controller manager.\n\nCertificate signers may not honor this field for various reasons:\n\n 1. Old signer that is unaware of the field (such as the in-tree\n implementations prior to v1.22)\n 2. Signer whose configured maximum is shorter than the requested duration\n 3. Signer whose configured minimum is longer than the requested duration\n\nThe minimum valid value for expirationSeconds is 600, i.e. 10 minutes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "extra".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("extra contains extra attributes of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "groups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("groups contains group membership of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "request".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("request contains an x509 certificate signing request encoded in a \"CERTIFICATE REQUEST\" PEM block. When serialized as JSON or YAML, the data is additionally base64-encoded.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }), + ), + ( + "signerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("signerName indicates the requested signer, and is a qualified name.\n\nList/watch requests for CertificateSigningRequests can filter on this field using a \"spec.signerName=NAME\" fieldSelector.\n\nWell-known Kubernetes signers are:\n 1. \"kubernetes.io/kube-apiserver-client\": issues client certificates that can be used to authenticate to kube-apiserver.\n Requests for this signer are never auto-approved by kube-controller-manager, can be issued by the \"csrsigning\" controller in kube-controller-manager.\n 2. \"kubernetes.io/kube-apiserver-client-kubelet\": issues client certificates that kubelets use to authenticate to kube-apiserver.\n Requests for this signer can be auto-approved by the \"csrapproving\" controller in kube-controller-manager, and can be issued by the \"csrsigning\" controller in kube-controller-manager.\n 3. \"kubernetes.io/kubelet-serving\" issues serving certificates that kubelets use to serve TLS endpoints, which kube-apiserver can connect to securely.\n Requests for this signer are never auto-approved by kube-controller-manager, and can be issued by the \"csrsigning\" controller in kube-controller-manager.\n\nMore details are available at https://k8s.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signers\n\nCustom signerNames can also be specified. The signer defines:\n 1. Trust distribution: how trust (CA bundles) are distributed.\n 2. Permitted subjects: and behavior when a disallowed subject is requested.\n 3. Required, permitted, or forbidden x509 extensions in the request (including whether subjectAltNames are allowed, which types, restrictions on allowed values) and behavior when a disallowed extension is requested.\n 4. Required, permitted, or forbidden key usages / extended key usages.\n 5. Expiration/certificate lifetime: whether it is fixed by the signer, configurable by the admin.\n 6. Whether or not requests for CA certificates are allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("uid contains the uid of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "usages".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("usages specifies a set of key usages requested in the issued certificate.\n\nRequests for TLS client certificates typically request: \"digital signature\", \"key encipherment\", \"client auth\".\n\nRequests for TLS serving certificates typically request: \"key encipherment\", \"digital signature\", \"server auth\".\n\nValid values are:\n \"signing\", \"digital signature\", \"content commitment\",\n \"key encipherment\", \"key agreement\", \"data encipherment\",\n \"cert sign\", \"crl sign\", \"encipher only\", \"decipher only\", \"any\",\n \"server auth\", \"client auth\",\n \"code signing\", \"email protection\", \"s/mime\",\n \"ipsec end system\", \"ipsec tunnel\", \"ipsec user\",\n \"timestamping\", \"ocsp signing\", \"microsoft sgc\", \"netscape sgc\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "username".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("username contains the name of the user that created the CertificateSigningRequest. Populated by the API server on creation and immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "request".to_owned(), + "signerName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1/certificate_signing_request_status.rs b/src/v1_30/api/certificates/v1/certificate_signing_request_status.rs new file mode 100644 index 000000000..d17c51933 --- /dev/null +++ b/src/v1_30/api/certificates/v1/certificate_signing_request_status.rs @@ -0,0 +1,185 @@ +// Generated from definition io.k8s.api.certificates.v1.CertificateSigningRequestStatus + +/// CertificateSigningRequestStatus contains conditions used to indicate approved/denied/failed status of the request, and the issued certificate. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CertificateSigningRequestStatus { + /// certificate is populated with an issued certificate by the signer after an Approved condition is present. This field is set via the /status subresource. Once populated, this field is immutable. + /// + /// If the certificate signing request is denied, a condition of type "Denied" is added and this field remains empty. If the signer cannot issue the certificate, a condition of type "Failed" is added and this field remains empty. + /// + /// Validation requirements: + /// 1. certificate must contain one or more PEM blocks. + /// 2. All PEM blocks must have the "CERTIFICATE" label, contain no headers, and the encoded data + /// must be a BER-encoded ASN.1 Certificate structure as described in section 4 of RFC5280. + /// 3. Non-PEM content may appear before or after the "CERTIFICATE" PEM blocks and is unvalidated, + /// to allow for explanatory text as described in section 5.2 of RFC7468. + /// + /// If more than one PEM block is present, and the definition of the requested spec.signerName does not indicate otherwise, the first block is the issued certificate, and subsequent blocks should be treated as intermediate certificates and presented in TLS handshakes. + /// + /// The certificate is encoded in PEM format. + /// + /// When serialized as JSON or YAML, the data is additionally base64-encoded, so it consists of: + /// + /// base64( + /// -----BEGIN CERTIFICATE----- + /// ... + /// -----END CERTIFICATE----- + /// ) + pub certificate: Option, + + /// conditions applied to the request. Known conditions are "Approved", "Denied", and "Failed". + pub conditions: Option>, +} + +impl crate::DeepMerge for CertificateSigningRequestStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.certificate, other.certificate); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CertificateSigningRequestStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_certificate, + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "certificate" => Field::Key_certificate, + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CertificateSigningRequestStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CertificateSigningRequestStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_certificate: Option = None; + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_certificate => value_certificate = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CertificateSigningRequestStatus { + certificate: value_certificate, + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "CertificateSigningRequestStatus", + &[ + "certificate", + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CertificateSigningRequestStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CertificateSigningRequestStatus", + self.certificate.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.certificate { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "certificate", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CertificateSigningRequestStatus { + fn schema_name() -> String { + "io.k8s.api.certificates.v1.CertificateSigningRequestStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CertificateSigningRequestStatus contains conditions used to indicate approved/denied/failed status of the request, and the issued certificate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "certificate".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("certificate is populated with an issued certificate by the signer after an Approved condition is present. This field is set via the /status subresource. Once populated, this field is immutable.\n\nIf the certificate signing request is denied, a condition of type \"Denied\" is added and this field remains empty. If the signer cannot issue the certificate, a condition of type \"Failed\" is added and this field remains empty.\n\nValidation requirements:\n 1. certificate must contain one or more PEM blocks.\n 2. All PEM blocks must have the \"CERTIFICATE\" label, contain no headers, and the encoded data\n must be a BER-encoded ASN.1 Certificate structure as described in section 4 of RFC5280.\n 3. Non-PEM content may appear before or after the \"CERTIFICATE\" PEM blocks and is unvalidated,\n to allow for explanatory text as described in section 5.2 of RFC7468.\n\nIf more than one PEM block is present, and the definition of the requested spec.signerName does not indicate otherwise, the first block is the issued certificate, and subsequent blocks should be treated as intermediate certificates and presented in TLS handshakes.\n\nThe certificate is encoded in PEM format.\n\nWhen serialized as JSON or YAML, the data is additionally base64-encoded, so it consists of:\n\n base64(\n -----BEGIN CERTIFICATE-----\n ...\n -----END CERTIFICATE-----\n )".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions applied to the request. Known conditions are \"Approved\", \"Denied\", and \"Failed\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1/mod.rs b/src/v1_30/api/certificates/v1/mod.rs new file mode 100644 index 000000000..4e57ebf3d --- /dev/null +++ b/src/v1_30/api/certificates/v1/mod.rs @@ -0,0 +1,12 @@ + +mod certificate_signing_request; +pub use self::certificate_signing_request::CertificateSigningRequest; + +mod certificate_signing_request_condition; +pub use self::certificate_signing_request_condition::CertificateSigningRequestCondition; + +mod certificate_signing_request_spec; +pub use self::certificate_signing_request_spec::CertificateSigningRequestSpec; + +mod certificate_signing_request_status; +pub use self::certificate_signing_request_status::CertificateSigningRequestStatus; diff --git a/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle.rs b/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle.rs new file mode 100644 index 000000000..0a0363b69 --- /dev/null +++ b/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle.rs @@ -0,0 +1,222 @@ +// Generated from definition io.k8s.api.certificates.v1alpha1.ClusterTrustBundle + +/// ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates). +/// +/// ClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to. +/// +/// It can be optionally associated with a particular assigner, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterTrustBundle { + /// metadata contains the object metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec contains the signer (if any) and trust anchors. + pub spec: crate::api::certificates::v1alpha1::ClusterTrustBundleSpec, +} + +impl crate::Resource for ClusterTrustBundle { + const API_VERSION: &'static str = "certificates.k8s.io/v1alpha1"; + const GROUP: &'static str = "certificates.k8s.io"; + const KIND: &'static str = "ClusterTrustBundle"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "clustertrustbundles"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ClusterTrustBundle { + const LIST_KIND: &'static str = "ClusterTrustBundleList"; +} + +impl crate::Metadata for ClusterTrustBundle { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ClusterTrustBundle { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterTrustBundle { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterTrustBundle; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterTrustBundle { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterTrustBundle { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterTrustBundle { + fn schema_name() -> String { + "io.k8s.api.certificates.v1alpha1.ClusterTrustBundle".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).\n\nClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the `clusterTrustBundle` projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.\n\nIt can be optionally associated with a particular assigner, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("metadata contains the object metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec contains the signer (if any) and trust anchors.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle_spec.rs b/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle_spec.rs new file mode 100644 index 000000000..17150a404 --- /dev/null +++ b/src/v1_30/api/certificates/v1alpha1/cluster_trust_bundle_spec.rs @@ -0,0 +1,165 @@ +// Generated from definition io.k8s.api.certificates.v1alpha1.ClusterTrustBundleSpec + +/// ClusterTrustBundleSpec contains the signer and trust anchors. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterTrustBundleSpec { + /// signerName indicates the associated signer, if any. + /// + /// In order to create or update a ClusterTrustBundle that sets signerName, you must have the following cluster-scoped permission: group=certificates.k8s.io resource=signers resourceName=\ verb=attest. + /// + /// If signerName is not empty, then the ClusterTrustBundle object must be named with the signer name as a prefix (translating slashes to colons). For example, for the signer name `example.com/foo`, valid ClusterTrustBundle object names include `example.com:foo:abc` and `example.com:foo:v1`. + /// + /// If signerName is empty, then the ClusterTrustBundle object's name must not have such a prefix. + /// + /// List/watch requests for ClusterTrustBundles can filter on this field using a `spec.signerName=NAME` field selector. + pub signer_name: Option, + + /// trustBundle contains the individual X.509 trust anchors for this bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates. + /// + /// The data must consist only of PEM certificate blocks that parse as valid X.509 certificates. Each certificate must include a basic constraints extension with the CA bit set. The API server will reject objects that contain duplicate certificates, or that use PEM block headers. + /// + /// Users of ClusterTrustBundles, including Kubelet, are free to reorder and deduplicate certificate blocks in this file according to their own logic, as well as to drop PEM block headers and inter-block data. + pub trust_bundle: String, +} + +impl crate::DeepMerge for ClusterTrustBundleSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.signer_name, other.signer_name); + crate::DeepMerge::merge_from(&mut self.trust_bundle, other.trust_bundle); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterTrustBundleSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_signer_name, + Key_trust_bundle, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "signerName" => Field::Key_signer_name, + "trustBundle" => Field::Key_trust_bundle, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterTrustBundleSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ClusterTrustBundleSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_signer_name: Option = None; + let mut value_trust_bundle: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_signer_name => value_signer_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_trust_bundle => value_trust_bundle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterTrustBundleSpec { + signer_name: value_signer_name, + trust_bundle: value_trust_bundle.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ClusterTrustBundleSpec", + &[ + "signerName", + "trustBundle", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterTrustBundleSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ClusterTrustBundleSpec", + 1 + + self.signer_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.signer_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "signerName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "trustBundle", &self.trust_bundle)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterTrustBundleSpec { + fn schema_name() -> String { + "io.k8s.api.certificates.v1alpha1.ClusterTrustBundleSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterTrustBundleSpec contains the signer and trust anchors.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "signerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("signerName indicates the associated signer, if any.\n\nIn order to create or update a ClusterTrustBundle that sets signerName, you must have the following cluster-scoped permission: group=certificates.k8s.io resource=signers resourceName= verb=attest.\n\nIf signerName is not empty, then the ClusterTrustBundle object must be named with the signer name as a prefix (translating slashes to colons). For example, for the signer name `example.com/foo`, valid ClusterTrustBundle object names include `example.com:foo:abc` and `example.com:foo:v1`.\n\nIf signerName is empty, then the ClusterTrustBundle object's name must not have such a prefix.\n\nList/watch requests for ClusterTrustBundles can filter on this field using a `spec.signerName=NAME` field selector.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "trustBundle".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("trustBundle contains the individual X.509 trust anchors for this bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates.\n\nThe data must consist only of PEM certificate blocks that parse as valid X.509 certificates. Each certificate must include a basic constraints extension with the CA bit set. The API server will reject objects that contain duplicate certificates, or that use PEM block headers.\n\nUsers of ClusterTrustBundles, including Kubelet, are free to reorder and deduplicate certificate blocks in this file according to their own logic, as well as to drop PEM block headers and inter-block data.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "trustBundle".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/certificates/v1alpha1/mod.rs b/src/v1_30/api/certificates/v1alpha1/mod.rs new file mode 100644 index 000000000..b26a6ecae --- /dev/null +++ b/src/v1_30/api/certificates/v1alpha1/mod.rs @@ -0,0 +1,6 @@ + +mod cluster_trust_bundle; +pub use self::cluster_trust_bundle::ClusterTrustBundle; + +mod cluster_trust_bundle_spec; +pub use self::cluster_trust_bundle_spec::ClusterTrustBundleSpec; diff --git a/src/v1_30/api/coordination/mod.rs b/src/v1_30/api/coordination/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/coordination/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/coordination/v1/lease.rs b/src/v1_30/api/coordination/v1/lease.rs new file mode 100644 index 000000000..f4eecc0b5 --- /dev/null +++ b/src/v1_30/api/coordination/v1/lease.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.coordination.v1.Lease + +/// Lease defines a lease concept. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Lease { + /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::Resource for Lease { + const API_VERSION: &'static str = "coordination.k8s.io/v1"; + const GROUP: &'static str = "coordination.k8s.io"; + const KIND: &'static str = "Lease"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "leases"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Lease { + const LIST_KIND: &'static str = "LeaseList"; +} + +impl crate::Metadata for Lease { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Lease { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Lease { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Lease; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Lease { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Lease { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Lease { + fn schema_name() -> String { + "io.k8s.api.coordination.v1.Lease".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Lease defines a lease concept.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/coordination/v1/lease_spec.rs b/src/v1_30/api/coordination/v1/lease_spec.rs new file mode 100644 index 000000000..8db6852aa --- /dev/null +++ b/src/v1_30/api/coordination/v1/lease_spec.rs @@ -0,0 +1,229 @@ +// Generated from definition io.k8s.api.coordination.v1.LeaseSpec + +/// LeaseSpec is a specification of a Lease. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LeaseSpec { + /// acquireTime is a time when the current lease was acquired. + pub acquire_time: Option, + + /// holderIdentity contains the identity of the holder of a current lease. + pub holder_identity: Option, + + /// leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measure against time of last observed renewTime. + pub lease_duration_seconds: Option, + + /// leaseTransitions is the number of transitions of a lease between holders. + pub lease_transitions: Option, + + /// renewTime is a time when the current holder of a lease has last updated the lease. + pub renew_time: Option, +} + +impl crate::DeepMerge for LeaseSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.acquire_time, other.acquire_time); + crate::DeepMerge::merge_from(&mut self.holder_identity, other.holder_identity); + crate::DeepMerge::merge_from(&mut self.lease_duration_seconds, other.lease_duration_seconds); + crate::DeepMerge::merge_from(&mut self.lease_transitions, other.lease_transitions); + crate::DeepMerge::merge_from(&mut self.renew_time, other.renew_time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LeaseSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_acquire_time, + Key_holder_identity, + Key_lease_duration_seconds, + Key_lease_transitions, + Key_renew_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "acquireTime" => Field::Key_acquire_time, + "holderIdentity" => Field::Key_holder_identity, + "leaseDurationSeconds" => Field::Key_lease_duration_seconds, + "leaseTransitions" => Field::Key_lease_transitions, + "renewTime" => Field::Key_renew_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LeaseSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LeaseSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_acquire_time: Option = None; + let mut value_holder_identity: Option = None; + let mut value_lease_duration_seconds: Option = None; + let mut value_lease_transitions: Option = None; + let mut value_renew_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_acquire_time => value_acquire_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_holder_identity => value_holder_identity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lease_duration_seconds => value_lease_duration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lease_transitions => value_lease_transitions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_renew_time => value_renew_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LeaseSpec { + acquire_time: value_acquire_time, + holder_identity: value_holder_identity, + lease_duration_seconds: value_lease_duration_seconds, + lease_transitions: value_lease_transitions, + renew_time: value_renew_time, + }) + } + } + + deserializer.deserialize_struct( + "LeaseSpec", + &[ + "acquireTime", + "holderIdentity", + "leaseDurationSeconds", + "leaseTransitions", + "renewTime", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LeaseSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LeaseSpec", + self.acquire_time.as_ref().map_or(0, |_| 1) + + self.holder_identity.as_ref().map_or(0, |_| 1) + + self.lease_duration_seconds.as_ref().map_or(0, |_| 1) + + self.lease_transitions.as_ref().map_or(0, |_| 1) + + self.renew_time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.acquire_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "acquireTime", value)?; + } + if let Some(value) = &self.holder_identity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "holderIdentity", value)?; + } + if let Some(value) = &self.lease_duration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "leaseDurationSeconds", value)?; + } + if let Some(value) = &self.lease_transitions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "leaseTransitions", value)?; + } + if let Some(value) = &self.renew_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "renewTime", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LeaseSpec { + fn schema_name() -> String { + "io.k8s.api.coordination.v1.LeaseSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LeaseSpec is a specification of a Lease.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "acquireTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("acquireTime is a time when the current lease was acquired.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "holderIdentity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("holderIdentity contains the identity of the holder of a current lease.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "leaseDurationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measure against time of last observed renewTime.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "leaseTransitions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("leaseTransitions is the number of transitions of a lease between holders.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "renewTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("renewTime is a time when the current holder of a lease has last updated the lease.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/coordination/v1/mod.rs b/src/v1_30/api/coordination/v1/mod.rs new file mode 100644 index 000000000..44537141f --- /dev/null +++ b/src/v1_30/api/coordination/v1/mod.rs @@ -0,0 +1,6 @@ + +mod lease; +pub use self::lease::Lease; + +mod lease_spec; +pub use self::lease_spec::LeaseSpec; diff --git a/src/v1_30/api/core/mod.rs b/src/v1_30/api/core/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/core/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/core/v1/affinity.rs b/src/v1_30/api/core/v1/affinity.rs new file mode 100644 index 000000000..e88d625a5 --- /dev/null +++ b/src/v1_30/api/core/v1/affinity.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.core.v1.Affinity + +/// Affinity is a group of affinity scheduling rules. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Affinity { + /// Describes node affinity scheduling rules for the pod. + pub node_affinity: Option, + + /// Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). + pub pod_affinity: Option, + + /// Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). + pub pod_anti_affinity: Option, +} + +impl crate::DeepMerge for Affinity { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.node_affinity, other.node_affinity); + crate::DeepMerge::merge_from(&mut self.pod_affinity, other.pod_affinity); + crate::DeepMerge::merge_from(&mut self.pod_anti_affinity, other.pod_anti_affinity); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Affinity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_node_affinity, + Key_pod_affinity, + Key_pod_anti_affinity, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nodeAffinity" => Field::Key_node_affinity, + "podAffinity" => Field::Key_pod_affinity, + "podAntiAffinity" => Field::Key_pod_anti_affinity, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Affinity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Affinity") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_node_affinity: Option = None; + let mut value_pod_affinity: Option = None; + let mut value_pod_anti_affinity: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_node_affinity => value_node_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_affinity => value_pod_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_anti_affinity => value_pod_anti_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Affinity { + node_affinity: value_node_affinity, + pod_affinity: value_pod_affinity, + pod_anti_affinity: value_pod_anti_affinity, + }) + } + } + + deserializer.deserialize_struct( + "Affinity", + &[ + "nodeAffinity", + "podAffinity", + "podAntiAffinity", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Affinity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Affinity", + self.node_affinity.as_ref().map_or(0, |_| 1) + + self.pod_affinity.as_ref().map_or(0, |_| 1) + + self.pod_anti_affinity.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.node_affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAffinity", value)?; + } + if let Some(value) = &self.pod_affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podAffinity", value)?; + } + if let Some(value) = &self.pod_anti_affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podAntiAffinity", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Affinity { + fn schema_name() -> String { + "io.k8s.api.core.v1.Affinity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Affinity is a group of affinity scheduling rules.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nodeAffinity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes node affinity scheduling rules for the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "podAffinity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "podAntiAffinity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/app_armor_profile.rs b/src/v1_30/api/core/v1/app_armor_profile.rs new file mode 100644 index 000000000..32749bea6 --- /dev/null +++ b/src/v1_30/api/core/v1/app_armor_profile.rs @@ -0,0 +1,156 @@ +// Generated from definition io.k8s.api.core.v1.AppArmorProfile + +/// AppArmorProfile defines a pod or container's AppArmor settings. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AppArmorProfile { + /// localhostProfile indicates a profile loaded on the node that should be used. The profile must be preconfigured on the node to work. Must match the loaded name of the profile. Must be set if and only if type is "Localhost". + pub localhost_profile: Option, + + /// type indicates which kind of AppArmor profile will be applied. Valid options are: + /// Localhost - a profile pre-loaded on the node. + /// RuntimeDefault - the container runtime's default profile. + /// Unconfined - no AppArmor enforcement. + pub type_: String, +} + +impl crate::DeepMerge for AppArmorProfile { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.localhost_profile, other.localhost_profile); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AppArmorProfile { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_localhost_profile, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "localhostProfile" => Field::Key_localhost_profile, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AppArmorProfile; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AppArmorProfile") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_localhost_profile: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_localhost_profile => value_localhost_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AppArmorProfile { + localhost_profile: value_localhost_profile, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AppArmorProfile", + &[ + "localhostProfile", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AppArmorProfile { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AppArmorProfile", + 1 + + self.localhost_profile.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.localhost_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "localhostProfile", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AppArmorProfile { + fn schema_name() -> String { + "io.k8s.api.core.v1.AppArmorProfile".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AppArmorProfile defines a pod or container's AppArmor settings.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "localhostProfile".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("localhostProfile indicates a profile loaded on the node that should be used. The profile must be preconfigured on the node to work. Must match the loaded name of the profile. Must be set if and only if type is \"Localhost\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type indicates which kind of AppArmor profile will be applied. Valid options are:\n Localhost - a profile pre-loaded on the node.\n RuntimeDefault - the container runtime's default profile.\n Unconfined - no AppArmor enforcement.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/attached_volume.rs b/src/v1_30/api/core/v1/attached_volume.rs new file mode 100644 index 000000000..ad4de07c1 --- /dev/null +++ b/src/v1_30/api/core/v1/attached_volume.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.AttachedVolume + +/// AttachedVolume describes a volume attached to a node +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AttachedVolume { + /// DevicePath represents the device path where the volume should be available + pub device_path: String, + + /// Name of the attached volume + pub name: String, +} + +impl crate::DeepMerge for AttachedVolume { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.device_path, other.device_path); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AttachedVolume { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_device_path, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "devicePath" => Field::Key_device_path, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AttachedVolume; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AttachedVolume") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_device_path: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_device_path => value_device_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AttachedVolume { + device_path: value_device_path.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AttachedVolume", + &[ + "devicePath", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AttachedVolume { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AttachedVolume", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "devicePath", &self.device_path)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AttachedVolume { + fn schema_name() -> String { + "io.k8s.api.core.v1.AttachedVolume".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AttachedVolume describes a volume attached to a node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "devicePath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DevicePath represents the device path where the volume should be available".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the attached volume".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "devicePath".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/aws_elastic_block_store_volume_source.rs b/src/v1_30/api/core/v1/aws_elastic_block_store_volume_source.rs new file mode 100644 index 000000000..21c6cb87d --- /dev/null +++ b/src/v1_30/api/core/v1/aws_elastic_block_store_volume_source.rs @@ -0,0 +1,206 @@ +// Generated from definition io.k8s.api.core.v1.AWSElasticBlockStoreVolumeSource + +/// Represents a Persistent Disk resource in AWS. +/// +/// An AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AWSElasticBlockStoreVolumeSource { + /// fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + pub fs_type: Option, + + /// partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + pub partition: Option, + + /// readOnly value true will force the readOnly setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + pub read_only: Option, + + /// volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + pub volume_id: String, +} + +impl crate::DeepMerge for AWSElasticBlockStoreVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.partition, other.partition); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.volume_id, other.volume_id); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AWSElasticBlockStoreVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_partition, + Key_read_only, + Key_volume_id, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "partition" => Field::Key_partition, + "readOnly" => Field::Key_read_only, + "volumeID" => Field::Key_volume_id, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AWSElasticBlockStoreVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AWSElasticBlockStoreVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_partition: Option = None; + let mut value_read_only: Option = None; + let mut value_volume_id: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_partition => value_partition = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_id => value_volume_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AWSElasticBlockStoreVolumeSource { + fs_type: value_fs_type, + partition: value_partition, + read_only: value_read_only, + volume_id: value_volume_id.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AWSElasticBlockStoreVolumeSource", + &[ + "fsType", + "partition", + "readOnly", + "volumeID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AWSElasticBlockStoreVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AWSElasticBlockStoreVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.partition.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.partition { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "partition", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeID", &self.volume_id)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AWSElasticBlockStoreVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.AWSElasticBlockStoreVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "partition".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly value true will force the readOnly setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "volumeID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/azure_disk_volume_source.rs b/src/v1_30/api/core/v1/azure_disk_volume_source.rs new file mode 100644 index 000000000..711a013e3 --- /dev/null +++ b/src/v1_30/api/core/v1/azure_disk_volume_source.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.core.v1.AzureDiskVolumeSource + +/// AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AzureDiskVolumeSource { + /// cachingMode is the Host Caching mode: None, Read Only, Read Write. + pub caching_mode: Option, + + /// diskName is the Name of the data disk in the blob storage + pub disk_name: String, + + /// diskURI is the URI of data disk in the blob storage + pub disk_uri: String, + + /// fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared + pub kind: Option, + + /// readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, +} + +impl crate::DeepMerge for AzureDiskVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.caching_mode, other.caching_mode); + crate::DeepMerge::merge_from(&mut self.disk_name, other.disk_name); + crate::DeepMerge::merge_from(&mut self.disk_uri, other.disk_uri); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AzureDiskVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_caching_mode, + Key_disk_name, + Key_disk_uri, + Key_fs_type, + Key_kind, + Key_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "cachingMode" => Field::Key_caching_mode, + "diskName" => Field::Key_disk_name, + "diskURI" => Field::Key_disk_uri, + "fsType" => Field::Key_fs_type, + "kind" => Field::Key_kind, + "readOnly" => Field::Key_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AzureDiskVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AzureDiskVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_caching_mode: Option = None; + let mut value_disk_name: Option = None; + let mut value_disk_uri: Option = None; + let mut value_fs_type: Option = None; + let mut value_kind: Option = None; + let mut value_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_caching_mode => value_caching_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_disk_name => value_disk_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_disk_uri => value_disk_uri = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AzureDiskVolumeSource { + caching_mode: value_caching_mode, + disk_name: value_disk_name.unwrap_or_default(), + disk_uri: value_disk_uri.unwrap_or_default(), + fs_type: value_fs_type, + kind: value_kind, + read_only: value_read_only, + }) + } + } + + deserializer.deserialize_struct( + "AzureDiskVolumeSource", + &[ + "cachingMode", + "diskName", + "diskURI", + "fsType", + "kind", + "readOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AzureDiskVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AzureDiskVolumeSource", + 2 + + self.caching_mode.as_ref().map_or(0, |_| 1) + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.caching_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cachingMode", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "diskName", &self.disk_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "diskURI", &self.disk_uri)?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AzureDiskVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.AzureDiskVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "cachingMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cachingMode is the Host Caching mode: None, Read Only, Read Write.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "diskName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("diskName is the Name of the data disk in the blob storage".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "diskURI".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("diskURI is the URI of data disk in the blob storage".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "diskName".to_owned(), + "diskURI".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/azure_file_persistent_volume_source.rs b/src/v1_30/api/core/v1/azure_file_persistent_volume_source.rs new file mode 100644 index 000000000..71637c7da --- /dev/null +++ b/src/v1_30/api/core/v1/azure_file_persistent_volume_source.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.core.v1.AzureFilePersistentVolumeSource + +/// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AzureFilePersistentVolumeSource { + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretName is the name of secret that contains Azure Storage Account Name and Key + pub secret_name: String, + + /// secretNamespace is the namespace of the secret that contains Azure Storage Account Name and Key default is the same as the Pod + pub secret_namespace: Option, + + /// shareName is the azure Share Name + pub share_name: String, +} + +impl crate::DeepMerge for AzureFilePersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_name, other.secret_name); + crate::DeepMerge::merge_from(&mut self.secret_namespace, other.secret_namespace); + crate::DeepMerge::merge_from(&mut self.share_name, other.share_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AzureFilePersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_read_only, + Key_secret_name, + Key_secret_namespace, + Key_share_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "readOnly" => Field::Key_read_only, + "secretName" => Field::Key_secret_name, + "secretNamespace" => Field::Key_secret_namespace, + "shareName" => Field::Key_share_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AzureFilePersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AzureFilePersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_read_only: Option = None; + let mut value_secret_name: Option = None; + let mut value_secret_namespace: Option = None; + let mut value_share_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_name => value_secret_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_namespace => value_secret_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_share_name => value_share_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AzureFilePersistentVolumeSource { + read_only: value_read_only, + secret_name: value_secret_name.unwrap_or_default(), + secret_namespace: value_secret_namespace, + share_name: value_share_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AzureFilePersistentVolumeSource", + &[ + "readOnly", + "secretName", + "secretNamespace", + "shareName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AzureFilePersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AzureFilePersistentVolumeSource", + 2 + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretName", &self.secret_name)?; + if let Some(value) = &self.secret_namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretNamespace", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shareName", &self.share_name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AzureFilePersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.AzureFilePersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AzureFile represents an Azure File Service mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretName is the name of secret that contains Azure Storage Account Name and Key".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "secretNamespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretNamespace is the namespace of the secret that contains Azure Storage Account Name and Key default is the same as the Pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "shareName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("shareName is the azure Share Name".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "secretName".to_owned(), + "shareName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/azure_file_volume_source.rs b/src/v1_30/api/core/v1/azure_file_volume_source.rs new file mode 100644 index 000000000..0bf97282a --- /dev/null +++ b/src/v1_30/api/core/v1/azure_file_volume_source.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.core.v1.AzureFileVolumeSource + +/// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AzureFileVolumeSource { + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretName is the name of secret that contains Azure Storage Account Name and Key + pub secret_name: String, + + /// shareName is the azure share Name + pub share_name: String, +} + +impl crate::DeepMerge for AzureFileVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_name, other.secret_name); + crate::DeepMerge::merge_from(&mut self.share_name, other.share_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AzureFileVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_read_only, + Key_secret_name, + Key_share_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "readOnly" => Field::Key_read_only, + "secretName" => Field::Key_secret_name, + "shareName" => Field::Key_share_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AzureFileVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AzureFileVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_read_only: Option = None; + let mut value_secret_name: Option = None; + let mut value_share_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_name => value_secret_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_share_name => value_share_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AzureFileVolumeSource { + read_only: value_read_only, + secret_name: value_secret_name.unwrap_or_default(), + share_name: value_share_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "AzureFileVolumeSource", + &[ + "readOnly", + "secretName", + "shareName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AzureFileVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AzureFileVolumeSource", + 2 + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretName", &self.secret_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shareName", &self.share_name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AzureFileVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.AzureFileVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AzureFile represents an Azure File Service mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretName is the name of secret that contains Azure Storage Account Name and Key".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "shareName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("shareName is the azure share Name".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "secretName".to_owned(), + "shareName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/binding.rs b/src/v1_30/api/core/v1/binding.rs new file mode 100644 index 000000000..e85e0e64f --- /dev/null +++ b/src/v1_30/api/core/v1/binding.rs @@ -0,0 +1,214 @@ +// Generated from definition io.k8s.api.core.v1.Binding + +/// Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Binding { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// The target object that you want to bind to the standard object. + pub target: crate::api::core::v1::ObjectReference, +} + +impl crate::Resource for Binding { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Binding"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "bindings"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::Metadata for Binding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Binding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.target, other.target); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Binding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_target, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "target" => Field::Key_target, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Binding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_target: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target => value_target = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Binding { + metadata: value_metadata.unwrap_or_default(), + target: value_target.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "target", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Binding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "target", &self.target)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Binding { + fn schema_name() -> String { + "io.k8s.api.core.v1.Binding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "target".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The target object that you want to bind to the standard object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "target".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/capabilities.rs b/src/v1_30/api/core/v1/capabilities.rs new file mode 100644 index 000000000..1a260b525 --- /dev/null +++ b/src/v1_30/api/core/v1/capabilities.rs @@ -0,0 +1,170 @@ +// Generated from definition io.k8s.api.core.v1.Capabilities + +/// Adds and removes POSIX capabilities from running containers. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Capabilities { + /// Added capabilities + pub add: Option>, + + /// Removed capabilities + pub drop: Option>, +} + +impl crate::DeepMerge for Capabilities { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.add, other.add); + crate::merge_strategies::list::atomic(&mut self.drop, other.drop); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Capabilities { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_add, + Key_drop, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "add" => Field::Key_add, + "drop" => Field::Key_drop, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Capabilities; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Capabilities") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_add: Option> = None; + let mut value_drop: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_add => value_add = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_drop => value_drop = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Capabilities { + add: value_add, + drop: value_drop, + }) + } + } + + deserializer.deserialize_struct( + "Capabilities", + &[ + "add", + "drop", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Capabilities { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Capabilities", + self.add.as_ref().map_or(0, |_| 1) + + self.drop.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.add { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "add", value)?; + } + if let Some(value) = &self.drop { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "drop", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Capabilities { + fn schema_name() -> String { + "io.k8s.api.core.v1.Capabilities".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Adds and removes POSIX capabilities from running containers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "add".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Added capabilities".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "drop".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Removed capabilities".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/ceph_fs_persistent_volume_source.rs b/src/v1_30/api/core/v1/ceph_fs_persistent_volume_source.rs new file mode 100644 index 000000000..33c556a6c --- /dev/null +++ b/src/v1_30/api/core/v1/ceph_fs_persistent_volume_source.rs @@ -0,0 +1,262 @@ +// Generated from definition io.k8s.api.core.v1.CephFSPersistentVolumeSource + +/// Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CephFSPersistentVolumeSource { + /// monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub monitors: Vec, + + /// path is Optional: Used as the mounted root, rather than the full Ceph tree, default is / + pub path: Option, + + /// readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub read_only: Option, + + /// secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub secret_file: Option, + + /// secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub secret_ref: Option, + + /// user is Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub user: Option, +} + +impl crate::DeepMerge for CephFSPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.monitors, other.monitors); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_file, other.secret_file); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CephFSPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_monitors, + Key_path, + Key_read_only, + Key_secret_file, + Key_secret_ref, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "monitors" => Field::Key_monitors, + "path" => Field::Key_path, + "readOnly" => Field::Key_read_only, + "secretFile" => Field::Key_secret_file, + "secretRef" => Field::Key_secret_ref, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CephFSPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CephFSPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_monitors: Option> = None; + let mut value_path: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_file: Option = None; + let mut value_secret_ref: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_monitors => value_monitors = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_file => value_secret_file = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CephFSPersistentVolumeSource { + monitors: value_monitors.unwrap_or_default(), + path: value_path, + read_only: value_read_only, + secret_file: value_secret_file, + secret_ref: value_secret_ref, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "CephFSPersistentVolumeSource", + &[ + "monitors", + "path", + "readOnly", + "secretFile", + "secretRef", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CephFSPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CephFSPersistentVolumeSource", + 1 + + self.path.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_file.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "monitors", &self.monitors)?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_file { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretFile", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CephFSPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CephFSPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "monitors".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretFile".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("user is Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "monitors".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/ceph_fs_volume_source.rs b/src/v1_30/api/core/v1/ceph_fs_volume_source.rs new file mode 100644 index 000000000..91f358e3a --- /dev/null +++ b/src/v1_30/api/core/v1/ceph_fs_volume_source.rs @@ -0,0 +1,262 @@ +// Generated from definition io.k8s.api.core.v1.CephFSVolumeSource + +/// Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CephFSVolumeSource { + /// monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub monitors: Vec, + + /// path is Optional: Used as the mounted root, rather than the full Ceph tree, default is / + pub path: Option, + + /// readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub read_only: Option, + + /// secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub secret_file: Option, + + /// secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub secret_ref: Option, + + /// user is optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + pub user: Option, +} + +impl crate::DeepMerge for CephFSVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.monitors, other.monitors); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_file, other.secret_file); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CephFSVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_monitors, + Key_path, + Key_read_only, + Key_secret_file, + Key_secret_ref, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "monitors" => Field::Key_monitors, + "path" => Field::Key_path, + "readOnly" => Field::Key_read_only, + "secretFile" => Field::Key_secret_file, + "secretRef" => Field::Key_secret_ref, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CephFSVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CephFSVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_monitors: Option> = None; + let mut value_path: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_file: Option = None; + let mut value_secret_ref: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_monitors => value_monitors = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_file => value_secret_file = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CephFSVolumeSource { + monitors: value_monitors.unwrap_or_default(), + path: value_path, + read_only: value_read_only, + secret_file: value_secret_file, + secret_ref: value_secret_ref, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "CephFSVolumeSource", + &[ + "monitors", + "path", + "readOnly", + "secretFile", + "secretRef", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CephFSVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CephFSVolumeSource", + 1 + + self.path.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_file.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "monitors", &self.monitors)?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_file { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretFile", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CephFSVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CephFSVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "monitors".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretFile".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("user is optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "monitors".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/cinder_persistent_volume_source.rs b/src/v1_30/api/core/v1/cinder_persistent_volume_source.rs new file mode 100644 index 000000000..5c22d35fb --- /dev/null +++ b/src/v1_30/api/core/v1/cinder_persistent_volume_source.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.core.v1.CinderPersistentVolumeSource + +/// Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CinderPersistentVolumeSource { + /// fsType Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub fs_type: Option, + + /// readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub read_only: Option, + + /// secretRef is Optional: points to a secret object containing parameters used to connect to OpenStack. + pub secret_ref: Option, + + /// volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub volume_id: String, +} + +impl crate::DeepMerge for CinderPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.volume_id, other.volume_id); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CinderPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_read_only, + Key_secret_ref, + Key_volume_id, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "volumeID" => Field::Key_volume_id, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CinderPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CinderPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_volume_id: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_id => value_volume_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CinderPersistentVolumeSource { + fs_type: value_fs_type, + read_only: value_read_only, + secret_ref: value_secret_ref, + volume_id: value_volume_id.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CinderPersistentVolumeSource", + &[ + "fsType", + "readOnly", + "secretRef", + "volumeID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CinderPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CinderPersistentVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeID", &self.volume_id)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CinderPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CinderPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is Optional: points to a secret object containing parameters used to connect to OpenStack.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "volumeID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/cinder_volume_source.rs b/src/v1_30/api/core/v1/cinder_volume_source.rs new file mode 100644 index 000000000..b6cbb4ce1 --- /dev/null +++ b/src/v1_30/api/core/v1/cinder_volume_source.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.core.v1.CinderVolumeSource + +/// Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CinderVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub fs_type: Option, + + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub read_only: Option, + + /// secretRef is optional: points to a secret object containing parameters used to connect to OpenStack. + pub secret_ref: Option, + + /// volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub volume_id: String, +} + +impl crate::DeepMerge for CinderVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.volume_id, other.volume_id); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CinderVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_read_only, + Key_secret_ref, + Key_volume_id, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "volumeID" => Field::Key_volume_id, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CinderVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CinderVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_volume_id: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_id => value_volume_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CinderVolumeSource { + fs_type: value_fs_type, + read_only: value_read_only, + secret_ref: value_secret_ref, + volume_id: value_volume_id.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CinderVolumeSource", + &[ + "fsType", + "readOnly", + "secretRef", + "volumeID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CinderVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CinderVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeID", &self.volume_id)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CinderVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CinderVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is optional: points to a secret object containing parameters used to connect to OpenStack.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "volumeID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/claim_source.rs b/src/v1_30/api/core/v1/claim_source.rs new file mode 100644 index 000000000..7392be58d --- /dev/null +++ b/src/v1_30/api/core/v1/claim_source.rs @@ -0,0 +1,158 @@ +// Generated from definition io.k8s.api.core.v1.ClaimSource + +/// ClaimSource describes a reference to a ResourceClaim. +/// +/// Exactly one of these fields should be set. Consumers of this type must treat an empty object as if it has an unknown value. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClaimSource { + /// ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod. + pub resource_claim_name: Option, + + /// ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod. + /// + /// The template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. + /// + /// This field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim. + pub resource_claim_template_name: Option, +} + +impl crate::DeepMerge for ClaimSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.resource_claim_name, other.resource_claim_name); + crate::DeepMerge::merge_from(&mut self.resource_claim_template_name, other.resource_claim_template_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClaimSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_resource_claim_name, + Key_resource_claim_template_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "resourceClaimName" => Field::Key_resource_claim_name, + "resourceClaimTemplateName" => Field::Key_resource_claim_template_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClaimSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ClaimSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_resource_claim_name: Option = None; + let mut value_resource_claim_template_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_resource_claim_name => value_resource_claim_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_claim_template_name => value_resource_claim_template_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClaimSource { + resource_claim_name: value_resource_claim_name, + resource_claim_template_name: value_resource_claim_template_name, + }) + } + } + + deserializer.deserialize_struct( + "ClaimSource", + &[ + "resourceClaimName", + "resourceClaimTemplateName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClaimSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ClaimSource", + self.resource_claim_name.as_ref().map_or(0, |_| 1) + + self.resource_claim_template_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.resource_claim_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaimName", value)?; + } + if let Some(value) = &self.resource_claim_template_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaimTemplateName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClaimSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ClaimSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClaimSource describes a reference to a ResourceClaim.\n\nExactly one of these fields should be set. Consumers of this type must treat an empty object as if it has an unknown value.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "resourceClaimName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceClaimTemplateName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/client_ip_config.rs b/src/v1_30/api/core/v1/client_ip_config.rs new file mode 100644 index 000000000..401099923 --- /dev/null +++ b/src/v1_30/api/core/v1/client_ip_config.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.core.v1.ClientIPConfig + +/// ClientIPConfig represents the configurations of Client IP based session affinity. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClientIPConfig { + /// timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be \>0 && \<=86400(for 1 day) if ServiceAffinity == "ClientIP". Default value is 10800(for 3 hours). + pub timeout_seconds: Option, +} + +impl crate::DeepMerge for ClientIPConfig { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.timeout_seconds, other.timeout_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClientIPConfig { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_timeout_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "timeoutSeconds" => Field::Key_timeout_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClientIPConfig; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ClientIPConfig") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_timeout_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_timeout_seconds => value_timeout_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClientIPConfig { + timeout_seconds: value_timeout_seconds, + }) + } + } + + deserializer.deserialize_struct( + "ClientIPConfig", + &[ + "timeoutSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClientIPConfig { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ClientIPConfig", + self.timeout_seconds.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.timeout_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeoutSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClientIPConfig { + fn schema_name() -> String { + "io.k8s.api.core.v1.ClientIPConfig".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClientIPConfig represents the configurations of Client IP based session affinity.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "timeoutSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be >0 && <=86400(for 1 day) if ServiceAffinity == \"ClientIP\". Default value is 10800(for 3 hours).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/cluster_trust_bundle_projection.rs b/src/v1_30/api/core/v1/cluster_trust_bundle_projection.rs new file mode 100644 index 000000000..7672f8da2 --- /dev/null +++ b/src/v1_30/api/core/v1/cluster_trust_bundle_projection.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.core.v1.ClusterTrustBundleProjection + +/// ClusterTrustBundleProjection describes how to select a set of ClusterTrustBundle objects and project their contents into the pod filesystem. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterTrustBundleProjection { + /// Select all ClusterTrustBundles that match this label selector. Only has effect if signerName is set. Mutually-exclusive with name. If unset, interpreted as "match nothing". If set but empty, interpreted as "match everything". + pub label_selector: Option, + + /// Select a single ClusterTrustBundle by object name. Mutually-exclusive with signerName and labelSelector. + pub name: Option, + + /// If true, don't block pod startup if the referenced ClusterTrustBundle(s) aren't available. If using name, then the named ClusterTrustBundle is allowed not to exist. If using signerName, then the combination of signerName and labelSelector is allowed to match zero ClusterTrustBundles. + pub optional: Option, + + /// Relative path from the volume root to write the bundle. + pub path: String, + + /// Select all ClusterTrustBundles that match this signer name. Mutually-exclusive with name. The contents of all selected ClusterTrustBundles will be unified and deduplicated. + pub signer_name: Option, +} + +impl crate::DeepMerge for ClusterTrustBundleProjection { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.label_selector, other.label_selector); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.signer_name, other.signer_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterTrustBundleProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_label_selector, + Key_name, + Key_optional, + Key_path, + Key_signer_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "labelSelector" => Field::Key_label_selector, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + "path" => Field::Key_path, + "signerName" => Field::Key_signer_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterTrustBundleProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ClusterTrustBundleProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_label_selector: Option = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + let mut value_path: Option = None; + let mut value_signer_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_label_selector => value_label_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_signer_name => value_signer_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterTrustBundleProjection { + label_selector: value_label_selector, + name: value_name, + optional: value_optional, + path: value_path.unwrap_or_default(), + signer_name: value_signer_name, + }) + } + } + + deserializer.deserialize_struct( + "ClusterTrustBundleProjection", + &[ + "labelSelector", + "name", + "optional", + "path", + "signerName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterTrustBundleProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ClusterTrustBundleProjection", + 1 + + self.label_selector.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1) + + self.signer_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.label_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "labelSelector", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.signer_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "signerName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterTrustBundleProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.ClusterTrustBundleProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterTrustBundleProjection describes how to select a set of ClusterTrustBundle objects and project their contents into the pod filesystem.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "labelSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Select all ClusterTrustBundles that match this label selector. Only has effect if signerName is set. Mutually-exclusive with name. If unset, interpreted as \"match nothing\". If set but empty, interpreted as \"match everything\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Select a single ClusterTrustBundle by object name. Mutually-exclusive with signerName and labelSelector.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If true, don't block pod startup if the referenced ClusterTrustBundle(s) aren't available. If using name, then the named ClusterTrustBundle is allowed not to exist. If using signerName, then the combination of signerName and labelSelector is allowed to match zero ClusterTrustBundles.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Relative path from the volume root to write the bundle.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "signerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Select all ClusterTrustBundles that match this signer name. Mutually-exclusive with name. The contents of all selected ClusterTrustBundles will be unified and deduplicated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/component_condition.rs b/src/v1_30/api/core/v1/component_condition.rs new file mode 100644 index 000000000..a7dc3ee80 --- /dev/null +++ b/src/v1_30/api/core/v1/component_condition.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.core.v1.ComponentCondition + +/// Information about the condition of a component. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ComponentCondition { + /// Condition error code for a component. For example, a health check error code. + pub error: Option, + + /// Message about the condition for a component. For example, information about a health check. + pub message: Option, + + /// Status of the condition for a component. Valid values for "Healthy": "True", "False", or "Unknown". + pub status: String, + + /// Type of condition for a component. Valid value: "Healthy" + pub type_: String, +} + +impl crate::DeepMerge for ComponentCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.error, other.error); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ComponentCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_error, + Key_message, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "error" => Field::Key_error, + "message" => Field::Key_message, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ComponentCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ComponentCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_error: Option = None; + let mut value_message: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_error => value_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ComponentCondition { + error: value_error, + message: value_message, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ComponentCondition", + &[ + "error", + "message", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ComponentCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ComponentCondition", + 2 + + self.error.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "error", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ComponentCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.ComponentCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Information about the condition of a component.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "error".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Condition error code for a component. For example, a health check error code.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message about the condition for a component. For example, information about a health check.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition for a component. Valid values for \"Healthy\": \"True\", \"False\", or \"Unknown\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of condition for a component. Valid value: \"Healthy\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/component_status.rs b/src/v1_30/api/core/v1/component_status.rs new file mode 100644 index 000000000..60edb5a7f --- /dev/null +++ b/src/v1_30/api/core/v1/component_status.rs @@ -0,0 +1,231 @@ +// Generated from definition io.k8s.api.core.v1.ComponentStatus + +/// ComponentStatus (and ComponentStatusList) holds the cluster validation info. Deprecated: This API is deprecated in v1.19+ +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ComponentStatus { + /// List of component conditions observed + pub conditions: Option>, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, +} + +impl crate::Resource for ComponentStatus { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "ComponentStatus"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "componentstatuses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ComponentStatus { + const LIST_KIND: &'static str = "ComponentStatusList"; +} + +impl crate::Metadata for ComponentStatus { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ComponentStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ComponentStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_conditions, + Key_metadata, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "conditions" => Field::Key_conditions, + "metadata" => Field::Key_metadata, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ComponentStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_metadata: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ComponentStatus { + conditions: value_conditions, + metadata: value_metadata.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "conditions", + "metadata", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ComponentStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.conditions.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ComponentStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ComponentStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ComponentStatus (and ComponentStatusList) holds the cluster validation info. Deprecated: This API is deprecated in v1.19+".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of component conditions observed".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map.rs b/src/v1_30/api/core/v1/config_map.rs new file mode 100644 index 000000000..2916159f8 --- /dev/null +++ b/src/v1_30/api/core/v1/config_map.rs @@ -0,0 +1,293 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMap + +/// ConfigMap holds configuration data for pods to consume. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMap { + /// BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + pub binary_data: Option>, + + /// Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + pub data: Option>, + + /// Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + pub immutable: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, +} + +impl crate::Resource for ConfigMap { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "ConfigMap"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "configmaps"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ConfigMap { + const LIST_KIND: &'static str = "ConfigMapList"; +} + +impl crate::Metadata for ConfigMap { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ConfigMap { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.binary_data, other.binary_data, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.data, other.data, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.immutable, other.immutable); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMap { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_binary_data, + Key_data, + Key_immutable, + Key_metadata, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "binaryData" => Field::Key_binary_data, + "data" => Field::Key_data, + "immutable" => Field::Key_immutable, + "metadata" => Field::Key_metadata, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMap; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_binary_data: Option> = None; + let mut value_data: Option> = None; + let mut value_immutable: Option = None; + let mut value_metadata: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_binary_data => value_binary_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_data => value_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_immutable => value_immutable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMap { + binary_data: value_binary_data, + data: value_data, + immutable: value_immutable, + metadata: value_metadata.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "binaryData", + "data", + "immutable", + "metadata", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMap { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.binary_data.as_ref().map_or(0, |_| 1) + + self.data.as_ref().map_or(0, |_| 1) + + self.immutable.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.binary_data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "binaryData", value)?; + } + if let Some(value) = &self.data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "data", value)?; + } + if let Some(value) = &self.immutable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "immutable", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMap { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMap".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ConfigMap holds configuration data for pods to consume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "binaryData".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "data".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "immutable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map_env_source.rs b/src/v1_30/api/core/v1/config_map_env_source.rs new file mode 100644 index 000000000..f8cb8d16e --- /dev/null +++ b/src/v1_30/api/core/v1/config_map_env_source.rs @@ -0,0 +1,154 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMapEnvSource + +/// ConfigMapEnvSource selects a ConfigMap to populate the environment variables with. +/// +/// The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMapEnvSource { + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// Specify whether the ConfigMap must be defined + pub optional: Option, +} + +impl crate::DeepMerge for ConfigMapEnvSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMapEnvSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMapEnvSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ConfigMapEnvSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMapEnvSource { + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "ConfigMapEnvSource", + &[ + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMapEnvSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ConfigMapEnvSource", + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMapEnvSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMapEnvSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specify whether the ConfigMap must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map_key_selector.rs b/src/v1_30/api/core/v1/config_map_key_selector.rs new file mode 100644 index 000000000..927219d6c --- /dev/null +++ b/src/v1_30/api/core/v1/config_map_key_selector.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMapKeySelector + +/// Selects a key from a ConfigMap. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMapKeySelector { + /// The key to select. + pub key: String, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// Specify whether the ConfigMap or its key must be defined + pub optional: Option, +} + +impl crate::DeepMerge for ConfigMapKeySelector { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMapKeySelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMapKeySelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ConfigMapKeySelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMapKeySelector { + key: value_key.unwrap_or_default(), + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "ConfigMapKeySelector", + &[ + "key", + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMapKeySelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ConfigMapKeySelector", + 1 + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMapKeySelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMapKeySelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a key from a ConfigMap.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The key to select.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specify whether the ConfigMap or its key must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map_node_config_source.rs b/src/v1_30/api/core/v1/config_map_node_config_source.rs new file mode 100644 index 000000000..75c599bc9 --- /dev/null +++ b/src/v1_30/api/core/v1/config_map_node_config_source.rs @@ -0,0 +1,224 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMapNodeConfigSource + +/// ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. This API is deprecated since 1.22: https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMapNodeConfigSource { + /// KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure This field is required in all cases. + pub kubelet_config_key: String, + + /// Name is the metadata.name of the referenced ConfigMap. This field is required in all cases. + pub name: String, + + /// Namespace is the metadata.namespace of the referenced ConfigMap. This field is required in all cases. + pub namespace: String, + + /// ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status. + pub resource_version: Option, + + /// UID is the metadata.UID of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status. + pub uid: Option, +} + +impl crate::DeepMerge for ConfigMapNodeConfigSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.kubelet_config_key, other.kubelet_config_key); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMapNodeConfigSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_kubelet_config_key, + Key_name, + Key_namespace, + Key_resource_version, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "kubeletConfigKey" => Field::Key_kubelet_config_key, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "resourceVersion" => Field::Key_resource_version, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMapNodeConfigSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ConfigMapNodeConfigSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_kubelet_config_key: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_resource_version: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_kubelet_config_key => value_kubelet_config_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMapNodeConfigSource { + kubelet_config_key: value_kubelet_config_key.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespace: value_namespace.unwrap_or_default(), + resource_version: value_resource_version, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "ConfigMapNodeConfigSource", + &[ + "kubeletConfigKey", + "name", + "namespace", + "resourceVersion", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMapNodeConfigSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ConfigMapNodeConfigSource", + 3 + + self.resource_version.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kubeletConfigKey", &self.kubelet_config_key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", &self.namespace)?; + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMapNodeConfigSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMapNodeConfigSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. This API is deprecated since 1.22: https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "kubeletConfigKey".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure This field is required in all cases.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the metadata.name of the referenced ConfigMap. This field is required in all cases.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace is the metadata.namespace of the referenced ConfigMap. This field is required in all cases.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID is the metadata.UID of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kubeletConfigKey".to_owned(), + "name".to_owned(), + "namespace".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map_projection.rs b/src/v1_30/api/core/v1/config_map_projection.rs new file mode 100644 index 000000000..ea9187a2f --- /dev/null +++ b/src/v1_30/api/core/v1/config_map_projection.rs @@ -0,0 +1,183 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMapProjection + +/// Adapts a ConfigMap into a projected volume. +/// +/// The contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMapProjection { + /// items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + pub items: Option>, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// optional specify whether the ConfigMap or its keys must be defined + pub optional: Option, +} + +impl crate::DeepMerge for ConfigMapProjection { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.items, other.items); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMapProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_items, + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "items" => Field::Key_items, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMapProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ConfigMapProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_items: Option> = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMapProjection { + items: value_items, + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "ConfigMapProjection", + &[ + "items", + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMapProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ConfigMapProjection", + self.items.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMapProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMapProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Adapts a ConfigMap into a projected volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("optional specify whether the ConfigMap or its keys must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/config_map_volume_source.rs b/src/v1_30/api/core/v1/config_map_volume_source.rs new file mode 100644 index 000000000..7d5b55b8e --- /dev/null +++ b/src/v1_30/api/core/v1/config_map_volume_source.rs @@ -0,0 +1,209 @@ +// Generated from definition io.k8s.api.core.v1.ConfigMapVolumeSource + +/// Adapts a ConfigMap into a volume. +/// +/// The contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ConfigMapVolumeSource { + /// defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub default_mode: Option, + + /// items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + pub items: Option>, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// optional specify whether the ConfigMap or its keys must be defined + pub optional: Option, +} + +impl crate::DeepMerge for ConfigMapVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.default_mode, other.default_mode); + crate::merge_strategies::list::atomic(&mut self.items, other.items); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ConfigMapVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default_mode, + Key_items, + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "defaultMode" => Field::Key_default_mode, + "items" => Field::Key_items, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ConfigMapVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ConfigMapVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default_mode: Option = None; + let mut value_items: Option> = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default_mode => value_default_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ConfigMapVolumeSource { + default_mode: value_default_mode, + items: value_items, + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "ConfigMapVolumeSource", + &[ + "defaultMode", + "items", + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ConfigMapVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ConfigMapVolumeSource", + self.default_mode.as_ref().map_or(0, |_| 1) + + self.items.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultMode", value)?; + } + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ConfigMapVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ConfigMapVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Adapts a ConfigMap into a volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "defaultMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("optional specify whether the ConfigMap or its keys must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container.rs b/src/v1_30/api/core/v1/container.rs new file mode 100644 index 000000000..f889c4f97 --- /dev/null +++ b/src/v1_30/api/core/v1/container.rs @@ -0,0 +1,773 @@ +// Generated from definition io.k8s.api.core.v1.Container + +/// A single application container that you want to run within a pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Container { + /// Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + pub args: Option>, + + /// Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + pub command: Option>, + + /// List of environment variables to set in the container. Cannot be updated. + pub env: Option>, + + /// List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated. + pub env_from: Option>, + + /// Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets. + pub image: Option, + + /// Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + pub image_pull_policy: Option, + + /// Actions that the management system should take in response to container lifecycle events. Cannot be updated. + pub lifecycle: Option, + + /// Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + pub liveness_probe: Option, + + /// Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. + pub name: String, + + /// List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. + pub ports: Option>, + + /// Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + pub readiness_probe: Option, + + /// Resources resize policy for the container. + pub resize_policy: Option>, + + /// Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub resources: Option, + + /// RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is "Always". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Setting the RestartPolicy as "Always" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down. This lifecycle differs from normal init containers and is often referred to as a "sidecar" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed. + pub restart_policy: Option, + + /// SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + pub security_context: Option, + + /// StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + pub startup_probe: Option, + + /// Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false. + pub stdin: Option, + + /// Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false + pub stdin_once: Option, + + /// Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated. + pub termination_message_path: Option, + + /// Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated. + pub termination_message_policy: Option, + + /// Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false. + pub tty: Option, + + /// volumeDevices is the list of block devices to be used by the container. + pub volume_devices: Option>, + + /// Pod volumes to mount into the container's filesystem. Cannot be updated. + pub volume_mounts: Option>, + + /// Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. + pub working_dir: Option, +} + +impl crate::DeepMerge for Container { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.args, other.args); + crate::merge_strategies::list::atomic(&mut self.command, other.command); + crate::merge_strategies::list::map( + &mut self.env, + other.env, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.env_from, other.env_from); + crate::DeepMerge::merge_from(&mut self.image, other.image); + crate::DeepMerge::merge_from(&mut self.image_pull_policy, other.image_pull_policy); + crate::DeepMerge::merge_from(&mut self.lifecycle, other.lifecycle); + crate::DeepMerge::merge_from(&mut self.liveness_probe, other.liveness_probe); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::merge_strategies::list::map( + &mut self.ports, + other.ports, + &[|lhs, rhs| lhs.container_port == rhs.container_port], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.readiness_probe, other.readiness_probe); + crate::merge_strategies::list::atomic(&mut self.resize_policy, other.resize_policy); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.restart_policy, other.restart_policy); + crate::DeepMerge::merge_from(&mut self.security_context, other.security_context); + crate::DeepMerge::merge_from(&mut self.startup_probe, other.startup_probe); + crate::DeepMerge::merge_from(&mut self.stdin, other.stdin); + crate::DeepMerge::merge_from(&mut self.stdin_once, other.stdin_once); + crate::DeepMerge::merge_from(&mut self.termination_message_path, other.termination_message_path); + crate::DeepMerge::merge_from(&mut self.termination_message_policy, other.termination_message_policy); + crate::DeepMerge::merge_from(&mut self.tty, other.tty); + crate::merge_strategies::list::map( + &mut self.volume_devices, + other.volume_devices, + &[|lhs, rhs| lhs.device_path == rhs.device_path], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.volume_mounts, + other.volume_mounts, + &[|lhs, rhs| lhs.mount_path == rhs.mount_path], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.working_dir, other.working_dir); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Container { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_args, + Key_command, + Key_env, + Key_env_from, + Key_image, + Key_image_pull_policy, + Key_lifecycle, + Key_liveness_probe, + Key_name, + Key_ports, + Key_readiness_probe, + Key_resize_policy, + Key_resources, + Key_restart_policy, + Key_security_context, + Key_startup_probe, + Key_stdin, + Key_stdin_once, + Key_termination_message_path, + Key_termination_message_policy, + Key_tty, + Key_volume_devices, + Key_volume_mounts, + Key_working_dir, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "args" => Field::Key_args, + "command" => Field::Key_command, + "env" => Field::Key_env, + "envFrom" => Field::Key_env_from, + "image" => Field::Key_image, + "imagePullPolicy" => Field::Key_image_pull_policy, + "lifecycle" => Field::Key_lifecycle, + "livenessProbe" => Field::Key_liveness_probe, + "name" => Field::Key_name, + "ports" => Field::Key_ports, + "readinessProbe" => Field::Key_readiness_probe, + "resizePolicy" => Field::Key_resize_policy, + "resources" => Field::Key_resources, + "restartPolicy" => Field::Key_restart_policy, + "securityContext" => Field::Key_security_context, + "startupProbe" => Field::Key_startup_probe, + "stdin" => Field::Key_stdin, + "stdinOnce" => Field::Key_stdin_once, + "terminationMessagePath" => Field::Key_termination_message_path, + "terminationMessagePolicy" => Field::Key_termination_message_policy, + "tty" => Field::Key_tty, + "volumeDevices" => Field::Key_volume_devices, + "volumeMounts" => Field::Key_volume_mounts, + "workingDir" => Field::Key_working_dir, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Container; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Container") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_args: Option> = None; + let mut value_command: Option> = None; + let mut value_env: Option> = None; + let mut value_env_from: Option> = None; + let mut value_image: Option = None; + let mut value_image_pull_policy: Option = None; + let mut value_lifecycle: Option = None; + let mut value_liveness_probe: Option = None; + let mut value_name: Option = None; + let mut value_ports: Option> = None; + let mut value_readiness_probe: Option = None; + let mut value_resize_policy: Option> = None; + let mut value_resources: Option = None; + let mut value_restart_policy: Option = None; + let mut value_security_context: Option = None; + let mut value_startup_probe: Option = None; + let mut value_stdin: Option = None; + let mut value_stdin_once: Option = None; + let mut value_termination_message_path: Option = None; + let mut value_termination_message_policy: Option = None; + let mut value_tty: Option = None; + let mut value_volume_devices: Option> = None; + let mut value_volume_mounts: Option> = None; + let mut value_working_dir: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_args => value_args = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_command => value_command = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_env => value_env = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_env_from => value_env_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image_pull_policy => value_image_pull_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lifecycle => value_lifecycle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_liveness_probe => value_liveness_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_readiness_probe => value_readiness_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resize_policy => value_resize_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_restart_policy => value_restart_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_security_context => value_security_context = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_startup_probe => value_startup_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stdin => value_stdin = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stdin_once => value_stdin_once = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_message_path => value_termination_message_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_message_policy => value_termination_message_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tty => value_tty = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_devices => value_volume_devices = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_mounts => value_volume_mounts = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_working_dir => value_working_dir = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Container { + args: value_args, + command: value_command, + env: value_env, + env_from: value_env_from, + image: value_image, + image_pull_policy: value_image_pull_policy, + lifecycle: value_lifecycle, + liveness_probe: value_liveness_probe, + name: value_name.unwrap_or_default(), + ports: value_ports, + readiness_probe: value_readiness_probe, + resize_policy: value_resize_policy, + resources: value_resources, + restart_policy: value_restart_policy, + security_context: value_security_context, + startup_probe: value_startup_probe, + stdin: value_stdin, + stdin_once: value_stdin_once, + termination_message_path: value_termination_message_path, + termination_message_policy: value_termination_message_policy, + tty: value_tty, + volume_devices: value_volume_devices, + volume_mounts: value_volume_mounts, + working_dir: value_working_dir, + }) + } + } + + deserializer.deserialize_struct( + "Container", + &[ + "args", + "command", + "env", + "envFrom", + "image", + "imagePullPolicy", + "lifecycle", + "livenessProbe", + "name", + "ports", + "readinessProbe", + "resizePolicy", + "resources", + "restartPolicy", + "securityContext", + "startupProbe", + "stdin", + "stdinOnce", + "terminationMessagePath", + "terminationMessagePolicy", + "tty", + "volumeDevices", + "volumeMounts", + "workingDir", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Container { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Container", + 1 + + self.args.as_ref().map_or(0, |_| 1) + + self.command.as_ref().map_or(0, |_| 1) + + self.env.as_ref().map_or(0, |_| 1) + + self.env_from.as_ref().map_or(0, |_| 1) + + self.image.as_ref().map_or(0, |_| 1) + + self.image_pull_policy.as_ref().map_or(0, |_| 1) + + self.lifecycle.as_ref().map_or(0, |_| 1) + + self.liveness_probe.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1) + + self.readiness_probe.as_ref().map_or(0, |_| 1) + + self.resize_policy.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.restart_policy.as_ref().map_or(0, |_| 1) + + self.security_context.as_ref().map_or(0, |_| 1) + + self.startup_probe.as_ref().map_or(0, |_| 1) + + self.stdin.as_ref().map_or(0, |_| 1) + + self.stdin_once.as_ref().map_or(0, |_| 1) + + self.termination_message_path.as_ref().map_or(0, |_| 1) + + self.termination_message_policy.as_ref().map_or(0, |_| 1) + + self.tty.as_ref().map_or(0, |_| 1) + + self.volume_devices.as_ref().map_or(0, |_| 1) + + self.volume_mounts.as_ref().map_or(0, |_| 1) + + self.working_dir.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.args { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "args", value)?; + } + if let Some(value) = &self.command { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "command", value)?; + } + if let Some(value) = &self.env { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "env", value)?; + } + if let Some(value) = &self.env_from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "envFrom", value)?; + } + if let Some(value) = &self.image { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", value)?; + } + if let Some(value) = &self.image_pull_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "imagePullPolicy", value)?; + } + if let Some(value) = &self.lifecycle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lifecycle", value)?; + } + if let Some(value) = &self.liveness_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "livenessProbe", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + if let Some(value) = &self.readiness_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readinessProbe", value)?; + } + if let Some(value) = &self.resize_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resizePolicy", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.restart_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "restartPolicy", value)?; + } + if let Some(value) = &self.security_context { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "securityContext", value)?; + } + if let Some(value) = &self.startup_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startupProbe", value)?; + } + if let Some(value) = &self.stdin { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stdin", value)?; + } + if let Some(value) = &self.stdin_once { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stdinOnce", value)?; + } + if let Some(value) = &self.termination_message_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationMessagePath", value)?; + } + if let Some(value) = &self.termination_message_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationMessagePolicy", value)?; + } + if let Some(value) = &self.tty { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tty", value)?; + } + if let Some(value) = &self.volume_devices { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeDevices", value)?; + } + if let Some(value) = &self.volume_mounts { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMounts", value)?; + } + if let Some(value) = &self.working_dir { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "workingDir", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Container { + fn schema_name() -> String { + "io.k8s.api.core.v1.Container".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A single application container that you want to run within a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "args".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "command".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "env".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of environment variables to set in the container. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "envFrom".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "imagePullPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lifecycle".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Actions that the management system should take in response to container lifecycle events. Cannot be updated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "livenessProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readinessProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resizePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources resize policy for the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "restartPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is \"Always\". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Setting the RestartPolicy as \"Always\" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy \"Always\" will be shut down. This lifecycle differs from normal init containers and is often referred to as a \"sidecar\" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "securityContext".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "startupProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "stdin".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "stdinOnce".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "terminationMessagePath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "terminationMessagePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "tty".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeDevices".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeDevices is the list of block devices to be used by the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumeMounts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Pod volumes to mount into the container's filesystem. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "workingDir".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_image.rs b/src/v1_30/api/core/v1/container_image.rs new file mode 100644 index 000000000..5c7c179ed --- /dev/null +++ b/src/v1_30/api/core/v1/container_image.rs @@ -0,0 +1,162 @@ +// Generated from definition io.k8s.api.core.v1.ContainerImage + +/// Describe a container image +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerImage { + /// Names by which this image is known. e.g. \["kubernetes.example/hyperkube:v1.0.7", "cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7"\] + pub names: Option>, + + /// The size of the image in bytes. + pub size_bytes: Option, +} + +impl crate::DeepMerge for ContainerImage { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.names, other.names); + crate::DeepMerge::merge_from(&mut self.size_bytes, other.size_bytes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerImage { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_names, + Key_size_bytes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "names" => Field::Key_names, + "sizeBytes" => Field::Key_size_bytes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerImage; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerImage") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_names: Option> = None; + let mut value_size_bytes: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_names => value_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_size_bytes => value_size_bytes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerImage { + names: value_names, + size_bytes: value_size_bytes, + }) + } + } + + deserializer.deserialize_struct( + "ContainerImage", + &[ + "names", + "sizeBytes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerImage { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerImage", + self.names.as_ref().map_or(0, |_| 1) + + self.size_bytes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "names", value)?; + } + if let Some(value) = &self.size_bytes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sizeBytes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerImage { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerImage".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describe a container image".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "names".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Names by which this image is known. e.g. [\"kubernetes.example/hyperkube:v1.0.7\", \"cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7\"]".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "sizeBytes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The size of the image in bytes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_port.rs b/src/v1_30/api/core/v1/container_port.rs new file mode 100644 index 000000000..ee45ffe3a --- /dev/null +++ b/src/v1_30/api/core/v1/container_port.rs @@ -0,0 +1,230 @@ +// Generated from definition io.k8s.api.core.v1.ContainerPort + +/// ContainerPort represents a network port in a single container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerPort { + /// Number of port to expose on the pod's IP address. This must be a valid port number, 0 \< x \< 65536. + pub container_port: i32, + + /// What host IP to bind the external port to. + pub host_ip: Option, + + /// Number of port to expose on the host. If specified, this must be a valid port number, 0 \< x \< 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this. + pub host_port: Option, + + /// If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services. + pub name: Option, + + /// Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP". + pub protocol: Option, +} + +impl crate::DeepMerge for ContainerPort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_port, other.container_port); + crate::DeepMerge::merge_from(&mut self.host_ip, other.host_ip); + crate::DeepMerge::merge_from(&mut self.host_port, other.host_port); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerPort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_port, + Key_host_ip, + Key_host_port, + Key_name, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerPort" => Field::Key_container_port, + "hostIP" => Field::Key_host_ip, + "hostPort" => Field::Key_host_port, + "name" => Field::Key_name, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerPort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerPort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_port: Option = None; + let mut value_host_ip: Option = None; + let mut value_host_port: Option = None; + let mut value_name: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_port => value_container_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_ip => value_host_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_port => value_host_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerPort { + container_port: value_container_port.unwrap_or_default(), + host_ip: value_host_ip, + host_port: value_host_port, + name: value_name, + protocol: value_protocol, + }) + } + } + + deserializer.deserialize_struct( + "ContainerPort", + &[ + "containerPort", + "hostIP", + "hostPort", + "name", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerPort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerPort", + 1 + + self.host_ip.as_ref().map_or(0, |_| 1) + + self.host_port.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.protocol.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerPort", &self.container_port)?; + if let Some(value) = &self.host_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostIP", value)?; + } + if let Some(value) = &self.host_port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPort", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerPort { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerPort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerPort represents a network port in a single container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerPort".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "hostIP".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("What host IP to bind the external port to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "hostPort".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "containerPort".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_resize_policy.rs b/src/v1_30/api/core/v1/container_resize_policy.rs new file mode 100644 index 000000000..ad2649eb8 --- /dev/null +++ b/src/v1_30/api/core/v1/container_resize_policy.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.ContainerResizePolicy + +/// ContainerResizePolicy represents resource resize policy for the container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerResizePolicy { + /// Name of the resource to which this resource resize policy applies. Supported values: cpu, memory. + pub resource_name: String, + + /// Restart policy to apply when specified resource is resized. If not specified, it defaults to NotRequired. + pub restart_policy: String, +} + +impl crate::DeepMerge for ContainerResizePolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.resource_name, other.resource_name); + crate::DeepMerge::merge_from(&mut self.restart_policy, other.restart_policy); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerResizePolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_resource_name, + Key_restart_policy, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "resourceName" => Field::Key_resource_name, + "restartPolicy" => Field::Key_restart_policy, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerResizePolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerResizePolicy") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_resource_name: Option = None; + let mut value_restart_policy: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_resource_name => value_resource_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_restart_policy => value_restart_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerResizePolicy { + resource_name: value_resource_name.unwrap_or_default(), + restart_policy: value_restart_policy.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ContainerResizePolicy", + &[ + "resourceName", + "restartPolicy", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerResizePolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerResizePolicy", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceName", &self.resource_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "restartPolicy", &self.restart_policy)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerResizePolicy { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerResizePolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerResizePolicy represents resource resize policy for the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "resourceName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the resource to which this resource resize policy applies. Supported values: cpu, memory.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "restartPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Restart policy to apply when specified resource is resized. If not specified, it defaults to NotRequired.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "resourceName".to_owned(), + "restartPolicy".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_state.rs b/src/v1_30/api/core/v1/container_state.rs new file mode 100644 index 000000000..738023c71 --- /dev/null +++ b/src/v1_30/api/core/v1/container_state.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.core.v1.ContainerState + +/// ContainerState holds a possible state of container. Only one of its members may be specified. If none of them is specified, the default one is ContainerStateWaiting. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerState { + /// Details about a running container + pub running: Option, + + /// Details about a terminated container + pub terminated: Option, + + /// Details about a waiting container + pub waiting: Option, +} + +impl crate::DeepMerge for ContainerState { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.running, other.running); + crate::DeepMerge::merge_from(&mut self.terminated, other.terminated); + crate::DeepMerge::merge_from(&mut self.waiting, other.waiting); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerState { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_running, + Key_terminated, + Key_waiting, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "running" => Field::Key_running, + "terminated" => Field::Key_terminated, + "waiting" => Field::Key_waiting, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerState; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerState") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_running: Option = None; + let mut value_terminated: Option = None; + let mut value_waiting: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_running => value_running = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_terminated => value_terminated = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_waiting => value_waiting = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerState { + running: value_running, + terminated: value_terminated, + waiting: value_waiting, + }) + } + } + + deserializer.deserialize_struct( + "ContainerState", + &[ + "running", + "terminated", + "waiting", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerState { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerState", + self.running.as_ref().map_or(0, |_| 1) + + self.terminated.as_ref().map_or(0, |_| 1) + + self.waiting.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.running { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "running", value)?; + } + if let Some(value) = &self.terminated { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminated", value)?; + } + if let Some(value) = &self.waiting { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "waiting", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerState { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerState".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerState holds a possible state of container. Only one of its members may be specified. If none of them is specified, the default one is ContainerStateWaiting.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "running".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Details about a running container".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "terminated".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Details about a terminated container".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "waiting".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Details about a waiting container".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_state_running.rs b/src/v1_30/api/core/v1/container_state_running.rs new file mode 100644 index 000000000..cc59b4809 --- /dev/null +++ b/src/v1_30/api/core/v1/container_state_running.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.ContainerStateRunning + +/// ContainerStateRunning is a running state of a container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerStateRunning { + /// Time at which the container was last (re-)started + pub started_at: Option, +} + +impl crate::DeepMerge for ContainerStateRunning { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.started_at, other.started_at); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerStateRunning { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_started_at, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "startedAt" => Field::Key_started_at, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerStateRunning; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerStateRunning") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_started_at: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_started_at => value_started_at = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerStateRunning { + started_at: value_started_at, + }) + } + } + + deserializer.deserialize_struct( + "ContainerStateRunning", + &[ + "startedAt", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerStateRunning { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerStateRunning", + self.started_at.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.started_at { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startedAt", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerStateRunning { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerStateRunning".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerStateRunning is a running state of a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "startedAt".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time at which the container was last (re-)started".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_state_terminated.rs b/src/v1_30/api/core/v1/container_state_terminated.rs new file mode 100644 index 000000000..edd0af927 --- /dev/null +++ b/src/v1_30/api/core/v1/container_state_terminated.rs @@ -0,0 +1,280 @@ +// Generated from definition io.k8s.api.core.v1.ContainerStateTerminated + +/// ContainerStateTerminated is a terminated state of a container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerStateTerminated { + /// Container's ID in the format '\://\' + pub container_id: Option, + + /// Exit status from the last termination of the container + pub exit_code: i32, + + /// Time at which the container last terminated + pub finished_at: Option, + + /// Message regarding the last termination of the container + pub message: Option, + + /// (brief) reason from the last termination of the container + pub reason: Option, + + /// Signal from the last termination of the container + pub signal: Option, + + /// Time at which previous execution of the container started + pub started_at: Option, +} + +impl crate::DeepMerge for ContainerStateTerminated { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_id, other.container_id); + crate::DeepMerge::merge_from(&mut self.exit_code, other.exit_code); + crate::DeepMerge::merge_from(&mut self.finished_at, other.finished_at); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.signal, other.signal); + crate::DeepMerge::merge_from(&mut self.started_at, other.started_at); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerStateTerminated { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_id, + Key_exit_code, + Key_finished_at, + Key_message, + Key_reason, + Key_signal, + Key_started_at, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerID" => Field::Key_container_id, + "exitCode" => Field::Key_exit_code, + "finishedAt" => Field::Key_finished_at, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "signal" => Field::Key_signal, + "startedAt" => Field::Key_started_at, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerStateTerminated; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerStateTerminated") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_id: Option = None; + let mut value_exit_code: Option = None; + let mut value_finished_at: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_signal: Option = None; + let mut value_started_at: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_id => value_container_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_exit_code => value_exit_code = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_finished_at => value_finished_at = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_signal => value_signal = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_started_at => value_started_at = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerStateTerminated { + container_id: value_container_id, + exit_code: value_exit_code.unwrap_or_default(), + finished_at: value_finished_at, + message: value_message, + reason: value_reason, + signal: value_signal, + started_at: value_started_at, + }) + } + } + + deserializer.deserialize_struct( + "ContainerStateTerminated", + &[ + "containerID", + "exitCode", + "finishedAt", + "message", + "reason", + "signal", + "startedAt", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerStateTerminated { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerStateTerminated", + 1 + + self.container_id.as_ref().map_or(0, |_| 1) + + self.finished_at.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.signal.as_ref().map_or(0, |_| 1) + + self.started_at.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.container_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerID", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exitCode", &self.exit_code)?; + if let Some(value) = &self.finished_at { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "finishedAt", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.signal { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "signal", value)?; + } + if let Some(value) = &self.started_at { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startedAt", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerStateTerminated { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerStateTerminated".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerStateTerminated is a terminated state of a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container's ID in the format '://'".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "exitCode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Exit status from the last termination of the container".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "finishedAt".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time at which the container last terminated".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message regarding the last termination of the container".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("(brief) reason from the last termination of the container".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "signal".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Signal from the last termination of the container".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "startedAt".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time at which previous execution of the container started".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "exitCode".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_state_waiting.rs b/src/v1_30/api/core/v1/container_state_waiting.rs new file mode 100644 index 000000000..e9abda377 --- /dev/null +++ b/src/v1_30/api/core/v1/container_state_waiting.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.ContainerStateWaiting + +/// ContainerStateWaiting is a waiting state of a container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerStateWaiting { + /// Message regarding why the container is not yet running. + pub message: Option, + + /// (brief) reason the container is not yet running. + pub reason: Option, +} + +impl crate::DeepMerge for ContainerStateWaiting { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerStateWaiting { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_message, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "message" => Field::Key_message, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerStateWaiting; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerStateWaiting") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_message: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerStateWaiting { + message: value_message, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "ContainerStateWaiting", + &[ + "message", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerStateWaiting { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerStateWaiting", + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerStateWaiting { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerStateWaiting".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerStateWaiting is a waiting state of a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message regarding why the container is not yet running.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("(brief) reason the container is not yet running.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/container_status.rs b/src/v1_30/api/core/v1/container_status.rs new file mode 100644 index 000000000..57d6f90e5 --- /dev/null +++ b/src/v1_30/api/core/v1/container_status.rs @@ -0,0 +1,415 @@ +// Generated from definition io.k8s.api.core.v1.ContainerStatus + +/// ContainerStatus contains details for the current status of this container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ContainerStatus { + /// AllocatedResources represents the compute resources allocated for this container by the node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission and after successfully admitting desired pod resize. + pub allocated_resources: Option>, + + /// ContainerID is the ID of the container in the format '\://\'. Where type is a container runtime identifier, returned from Version call of CRI API (for example "containerd"). + pub container_id: Option, + + /// Image is the name of container image that the container is running. The container image may not match the image used in the PodSpec, as it may have been resolved by the runtime. More info: https://kubernetes.io/docs/concepts/containers/images. + pub image: String, + + /// ImageID is the image ID of the container's image. The image ID may not match the image ID of the image used in the PodSpec, as it may have been resolved by the runtime. + pub image_id: String, + + /// LastTerminationState holds the last termination state of the container to help debug container crashes and restarts. This field is not populated if the container is still running and RestartCount is 0. + pub last_state: Option, + + /// Name is a DNS_LABEL representing the unique name of the container. Each container in a pod must have a unique name across all container types. Cannot be updated. + pub name: String, + + /// Ready specifies whether the container is currently passing its readiness check. The value will change as readiness probes keep executing. If no readiness probes are specified, this field defaults to true once the container is fully started (see Started field). + /// + /// The value is typically used to determine whether a container is ready to accept traffic. + pub ready: bool, + + /// Resources represents the compute resource requests and limits that have been successfully enacted on the running container after it has been started or has been successfully resized. + pub resources: Option, + + /// RestartCount holds the number of times the container has been restarted. Kubelet makes an effort to always increment the value, but there are cases when the state may be lost due to node restarts and then the value may be reset to 0. The value is never negative. + pub restart_count: i32, + + /// Started indicates whether the container has finished its postStart lifecycle hook and passed its startup probe. Initialized as false, becomes true after startupProbe is considered successful. Resets to false when the container is restarted, or if kubelet loses state temporarily. In both cases, startup probes will run again. Is always true when no startupProbe is defined and container is running and has passed the postStart lifecycle hook. The null value must be treated the same as false. + pub started: Option, + + /// State holds details about the container's current condition. + pub state: Option, + + /// Status of volume mounts. + pub volume_mounts: Option>, +} + +impl crate::DeepMerge for ContainerStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.allocated_resources, other.allocated_resources, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.container_id, other.container_id); + crate::DeepMerge::merge_from(&mut self.image, other.image); + crate::DeepMerge::merge_from(&mut self.image_id, other.image_id); + crate::DeepMerge::merge_from(&mut self.last_state, other.last_state); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.ready, other.ready); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.restart_count, other.restart_count); + crate::DeepMerge::merge_from(&mut self.started, other.started); + crate::DeepMerge::merge_from(&mut self.state, other.state); + crate::merge_strategies::list::map( + &mut self.volume_mounts, + other.volume_mounts, + &[|lhs, rhs| lhs.mount_path == rhs.mount_path], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ContainerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allocated_resources, + Key_container_id, + Key_image, + Key_image_id, + Key_last_state, + Key_name, + Key_ready, + Key_resources, + Key_restart_count, + Key_started, + Key_state, + Key_volume_mounts, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allocatedResources" => Field::Key_allocated_resources, + "containerID" => Field::Key_container_id, + "image" => Field::Key_image, + "imageID" => Field::Key_image_id, + "lastState" => Field::Key_last_state, + "name" => Field::Key_name, + "ready" => Field::Key_ready, + "resources" => Field::Key_resources, + "restartCount" => Field::Key_restart_count, + "started" => Field::Key_started, + "state" => Field::Key_state, + "volumeMounts" => Field::Key_volume_mounts, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ContainerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ContainerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allocated_resources: Option> = None; + let mut value_container_id: Option = None; + let mut value_image: Option = None; + let mut value_image_id: Option = None; + let mut value_last_state: Option = None; + let mut value_name: Option = None; + let mut value_ready: Option = None; + let mut value_resources: Option = None; + let mut value_restart_count: Option = None; + let mut value_started: Option = None; + let mut value_state: Option = None; + let mut value_volume_mounts: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allocated_resources => value_allocated_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_container_id => value_container_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image_id => value_image_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_state => value_last_state = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready => value_ready = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_restart_count => value_restart_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_started => value_started = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_state => value_state = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_mounts => value_volume_mounts = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ContainerStatus { + allocated_resources: value_allocated_resources, + container_id: value_container_id, + image: value_image.unwrap_or_default(), + image_id: value_image_id.unwrap_or_default(), + last_state: value_last_state, + name: value_name.unwrap_or_default(), + ready: value_ready.unwrap_or_default(), + resources: value_resources, + restart_count: value_restart_count.unwrap_or_default(), + started: value_started, + state: value_state, + volume_mounts: value_volume_mounts, + }) + } + } + + deserializer.deserialize_struct( + "ContainerStatus", + &[ + "allocatedResources", + "containerID", + "image", + "imageID", + "lastState", + "name", + "ready", + "resources", + "restartCount", + "started", + "state", + "volumeMounts", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ContainerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ContainerStatus", + 5 + + self.allocated_resources.as_ref().map_or(0, |_| 1) + + self.container_id.as_ref().map_or(0, |_| 1) + + self.last_state.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.started.as_ref().map_or(0, |_| 1) + + self.state.as_ref().map_or(0, |_| 1) + + self.volume_mounts.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allocated_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocatedResources", value)?; + } + if let Some(value) = &self.container_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerID", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", &self.image)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "imageID", &self.image_id)?; + if let Some(value) = &self.last_state { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastState", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ready", &self.ready)?; + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "restartCount", &self.restart_count)?; + if let Some(value) = &self.started { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "started", value)?; + } + if let Some(value) = &self.state { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "state", value)?; + } + if let Some(value) = &self.volume_mounts { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMounts", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ContainerStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ContainerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerStatus contains details for the current status of this container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allocatedResources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AllocatedResources represents the compute resources allocated for this container by the node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission and after successfully admitting desired pod resize.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "containerID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerID is the ID of the container in the format '://'. Where type is a container runtime identifier, returned from Version call of CRI API (for example \"containerd\").".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Image is the name of container image that the container is running. The container image may not match the image used in the PodSpec, as it may have been resolved by the runtime. More info: https://kubernetes.io/docs/concepts/containers/images.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "imageID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ImageID is the image ID of the container's image. The image ID may not match the image ID of the image used in the PodSpec, as it may have been resolved by the runtime.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lastState".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LastTerminationState holds the last termination state of the container to help debug container crashes and restarts. This field is not populated if the container is still running and RestartCount is 0.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is a DNS_LABEL representing the unique name of the container. Each container in a pod must have a unique name across all container types. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ready".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ready specifies whether the container is currently passing its readiness check. The value will change as readiness probes keep executing. If no readiness probes are specified, this field defaults to true once the container is fully started (see Started field).\n\nThe value is typically used to determine whether a container is ready to accept traffic.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources represents the compute resource requests and limits that have been successfully enacted on the running container after it has been started or has been successfully resized.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "restartCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RestartCount holds the number of times the container has been restarted. Kubelet makes an effort to always increment the value, but there are cases when the state may be lost due to node restarts and then the value may be reset to 0. The value is never negative.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "started".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Started indicates whether the container has finished its postStart lifecycle hook and passed its startup probe. Initialized as false, becomes true after startupProbe is considered successful. Resets to false when the container is restarted, or if kubelet loses state temporarily. In both cases, startup probes will run again. Is always true when no startupProbe is defined and container is running and has passed the postStart lifecycle hook. The null value must be treated the same as false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "state".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("State holds details about the container's current condition.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeMounts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of volume mounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "image".to_owned(), + "imageID".to_owned(), + "name".to_owned(), + "ready".to_owned(), + "restartCount".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/csi_persistent_volume_source.rs b/src/v1_30/api/core/v1/csi_persistent_volume_source.rs new file mode 100644 index 000000000..dd5c7f765 --- /dev/null +++ b/src/v1_30/api/core/v1/csi_persistent_volume_source.rs @@ -0,0 +1,362 @@ +// Generated from definition io.k8s.api.core.v1.CSIPersistentVolumeSource + +/// Represents storage that is managed by an external CSI volume driver (Beta feature) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSIPersistentVolumeSource { + /// controllerExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerExpandVolume call. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + pub controller_expand_secret_ref: Option, + + /// controllerPublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerPublishVolume and ControllerUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + pub controller_publish_secret_ref: Option, + + /// driver is the name of the driver to use for this volume. Required. + pub driver: String, + + /// fsType to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". + pub fs_type: Option, + + /// nodeExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeExpandVolume call. This field is optional, may be omitted if no secret is required. If the secret object contains more than one secret, all secrets are passed. + pub node_expand_secret_ref: Option, + + /// nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + pub node_publish_secret_ref: Option, + + /// nodeStageSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeStageVolume and NodeStageVolume and NodeUnstageVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed. + pub node_stage_secret_ref: Option, + + /// readOnly value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write). + pub read_only: Option, + + /// volumeAttributes of the volume to publish. + pub volume_attributes: Option>, + + /// volumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. Required. + pub volume_handle: String, +} + +impl crate::DeepMerge for CSIPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.controller_expand_secret_ref, other.controller_expand_secret_ref); + crate::DeepMerge::merge_from(&mut self.controller_publish_secret_ref, other.controller_publish_secret_ref); + crate::DeepMerge::merge_from(&mut self.driver, other.driver); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.node_expand_secret_ref, other.node_expand_secret_ref); + crate::DeepMerge::merge_from(&mut self.node_publish_secret_ref, other.node_publish_secret_ref); + crate::DeepMerge::merge_from(&mut self.node_stage_secret_ref, other.node_stage_secret_ref); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::merge_strategies::map::granular(&mut self.volume_attributes, other.volume_attributes, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.volume_handle, other.volume_handle); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSIPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_controller_expand_secret_ref, + Key_controller_publish_secret_ref, + Key_driver, + Key_fs_type, + Key_node_expand_secret_ref, + Key_node_publish_secret_ref, + Key_node_stage_secret_ref, + Key_read_only, + Key_volume_attributes, + Key_volume_handle, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "controllerExpandSecretRef" => Field::Key_controller_expand_secret_ref, + "controllerPublishSecretRef" => Field::Key_controller_publish_secret_ref, + "driver" => Field::Key_driver, + "fsType" => Field::Key_fs_type, + "nodeExpandSecretRef" => Field::Key_node_expand_secret_ref, + "nodePublishSecretRef" => Field::Key_node_publish_secret_ref, + "nodeStageSecretRef" => Field::Key_node_stage_secret_ref, + "readOnly" => Field::Key_read_only, + "volumeAttributes" => Field::Key_volume_attributes, + "volumeHandle" => Field::Key_volume_handle, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSIPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CSIPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_controller_expand_secret_ref: Option = None; + let mut value_controller_publish_secret_ref: Option = None; + let mut value_driver: Option = None; + let mut value_fs_type: Option = None; + let mut value_node_expand_secret_ref: Option = None; + let mut value_node_publish_secret_ref: Option = None; + let mut value_node_stage_secret_ref: Option = None; + let mut value_read_only: Option = None; + let mut value_volume_attributes: Option> = None; + let mut value_volume_handle: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_controller_expand_secret_ref => value_controller_expand_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_controller_publish_secret_ref => value_controller_publish_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_driver => value_driver = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_expand_secret_ref => value_node_expand_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_publish_secret_ref => value_node_publish_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_stage_secret_ref => value_node_stage_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_attributes => value_volume_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_handle => value_volume_handle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSIPersistentVolumeSource { + controller_expand_secret_ref: value_controller_expand_secret_ref, + controller_publish_secret_ref: value_controller_publish_secret_ref, + driver: value_driver.unwrap_or_default(), + fs_type: value_fs_type, + node_expand_secret_ref: value_node_expand_secret_ref, + node_publish_secret_ref: value_node_publish_secret_ref, + node_stage_secret_ref: value_node_stage_secret_ref, + read_only: value_read_only, + volume_attributes: value_volume_attributes, + volume_handle: value_volume_handle.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CSIPersistentVolumeSource", + &[ + "controllerExpandSecretRef", + "controllerPublishSecretRef", + "driver", + "fsType", + "nodeExpandSecretRef", + "nodePublishSecretRef", + "nodeStageSecretRef", + "readOnly", + "volumeAttributes", + "volumeHandle", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSIPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CSIPersistentVolumeSource", + 2 + + self.controller_expand_secret_ref.as_ref().map_or(0, |_| 1) + + self.controller_publish_secret_ref.as_ref().map_or(0, |_| 1) + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.node_expand_secret_ref.as_ref().map_or(0, |_| 1) + + self.node_publish_secret_ref.as_ref().map_or(0, |_| 1) + + self.node_stage_secret_ref.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.volume_attributes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.controller_expand_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "controllerExpandSecretRef", value)?; + } + if let Some(value) = &self.controller_publish_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "controllerPublishSecretRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driver", &self.driver)?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.node_expand_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeExpandSecretRef", value)?; + } + if let Some(value) = &self.node_publish_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodePublishSecretRef", value)?; + } + if let Some(value) = &self.node_stage_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeStageSecretRef", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.volume_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeAttributes", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeHandle", &self.volume_handle)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSIPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CSIPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents storage that is managed by an external CSI volume driver (Beta feature)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "controllerExpandSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("controllerExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerExpandVolume call. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "controllerPublishSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("controllerPublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerPublishVolume and ControllerUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "driver".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("driver is the name of the driver to use for this volume. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeExpandSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeExpandSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeExpandVolume call. This field is optional, may be omitted if no secret is required. If the secret object contains more than one secret, all secrets are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nodePublishSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nodeStageSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeStageSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeStageVolume and NodeStageVolume and NodeUnstageVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeAttributes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeAttributes of the volume to publish.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumeHandle".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "driver".to_owned(), + "volumeHandle".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/csi_volume_source.rs b/src/v1_30/api/core/v1/csi_volume_source.rs new file mode 100644 index 000000000..77f1085f6 --- /dev/null +++ b/src/v1_30/api/core/v1/csi_volume_source.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.core.v1.CSIVolumeSource + +/// Represents a source location of a volume to mount, managed by an external CSI driver +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSIVolumeSource { + /// driver is the name of the CSI driver that handles this volume. Consult with your admin for the correct name as registered in the cluster. + pub driver: String, + + /// fsType to mount. Ex. "ext4", "xfs", "ntfs". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply. + pub fs_type: Option, + + /// nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed. + pub node_publish_secret_ref: Option, + + /// readOnly specifies a read-only configuration for the volume. Defaults to false (read/write). + pub read_only: Option, + + /// volumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values. + pub volume_attributes: Option>, +} + +impl crate::DeepMerge for CSIVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver, other.driver); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.node_publish_secret_ref, other.node_publish_secret_ref); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::merge_strategies::map::granular(&mut self.volume_attributes, other.volume_attributes, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSIVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver, + Key_fs_type, + Key_node_publish_secret_ref, + Key_read_only, + Key_volume_attributes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driver" => Field::Key_driver, + "fsType" => Field::Key_fs_type, + "nodePublishSecretRef" => Field::Key_node_publish_secret_ref, + "readOnly" => Field::Key_read_only, + "volumeAttributes" => Field::Key_volume_attributes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSIVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CSIVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver: Option = None; + let mut value_fs_type: Option = None; + let mut value_node_publish_secret_ref: Option = None; + let mut value_read_only: Option = None; + let mut value_volume_attributes: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver => value_driver = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_publish_secret_ref => value_node_publish_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_attributes => value_volume_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSIVolumeSource { + driver: value_driver.unwrap_or_default(), + fs_type: value_fs_type, + node_publish_secret_ref: value_node_publish_secret_ref, + read_only: value_read_only, + volume_attributes: value_volume_attributes, + }) + } + } + + deserializer.deserialize_struct( + "CSIVolumeSource", + &[ + "driver", + "fsType", + "nodePublishSecretRef", + "readOnly", + "volumeAttributes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSIVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CSIVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.node_publish_secret_ref.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.volume_attributes.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driver", &self.driver)?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.node_publish_secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodePublishSecretRef", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.volume_attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeAttributes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSIVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.CSIVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a source location of a volume to mount, managed by an external CSI driver".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driver".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("driver is the name of the CSI driver that handles this volume. Consult with your admin for the correct name as registered in the cluster.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType to mount. Ex. \"ext4\", \"xfs\", \"ntfs\". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodePublishSecretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly specifies a read-only configuration for the volume. Defaults to false (read/write).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeAttributes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "driver".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/daemon_endpoint.rs b/src/v1_30/api/core/v1/daemon_endpoint.rs new file mode 100644 index 000000000..795c3e342 --- /dev/null +++ b/src/v1_30/api/core/v1/daemon_endpoint.rs @@ -0,0 +1,129 @@ +// Generated from definition io.k8s.api.core.v1.DaemonEndpoint + +/// DaemonEndpoint contains information about a single Daemon endpoint. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DaemonEndpoint { + /// Port number of the given endpoint. + pub port: i32, +} + +impl crate::DeepMerge for DaemonEndpoint { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DaemonEndpoint { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "Port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DaemonEndpoint; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DaemonEndpoint") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DaemonEndpoint { + port: value_port.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "DaemonEndpoint", + &[ + "Port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DaemonEndpoint { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DaemonEndpoint", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "Port", &self.port)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DaemonEndpoint { + fn schema_name() -> String { + "io.k8s.api.core.v1.DaemonEndpoint".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DaemonEndpoint contains information about a single Daemon endpoint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "Port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Port number of the given endpoint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "Port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/downward_api_projection.rs b/src/v1_30/api/core/v1/downward_api_projection.rs new file mode 100644 index 000000000..950e2e564 --- /dev/null +++ b/src/v1_30/api/core/v1/downward_api_projection.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.core.v1.DownwardAPIProjection + +/// Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DownwardAPIProjection { + /// Items is a list of DownwardAPIVolume file + pub items: Option>, +} + +impl crate::DeepMerge for DownwardAPIProjection { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.items, other.items); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DownwardAPIProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_items, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "items" => Field::Key_items, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DownwardAPIProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DownwardAPIProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_items: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DownwardAPIProjection { + items: value_items, + }) + } + } + + deserializer.deserialize_struct( + "DownwardAPIProjection", + &[ + "items", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DownwardAPIProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DownwardAPIProjection", + self.items.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DownwardAPIProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.DownwardAPIProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Items is a list of DownwardAPIVolume file".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/downward_api_volume_file.rs b/src/v1_30/api/core/v1/downward_api_volume_file.rs new file mode 100644 index 000000000..a859aab9b --- /dev/null +++ b/src/v1_30/api/core/v1/downward_api_volume_file.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.core.v1.DownwardAPIVolumeFile + +/// DownwardAPIVolumeFile represents information to create the file containing the pod field +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DownwardAPIVolumeFile { + /// Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported. + pub field_ref: Option, + + /// Optional: mode bits used to set permissions on this file, must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub mode: Option, + + /// Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..' + pub path: String, + + /// Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + pub resource_field_ref: Option, +} + +impl crate::DeepMerge for DownwardAPIVolumeFile { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field_ref, other.field_ref); + crate::DeepMerge::merge_from(&mut self.mode, other.mode); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.resource_field_ref, other.resource_field_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DownwardAPIVolumeFile { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field_ref, + Key_mode, + Key_path, + Key_resource_field_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fieldRef" => Field::Key_field_ref, + "mode" => Field::Key_mode, + "path" => Field::Key_path, + "resourceFieldRef" => Field::Key_resource_field_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DownwardAPIVolumeFile; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DownwardAPIVolumeFile") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field_ref: Option = None; + let mut value_mode: Option = None; + let mut value_path: Option = None; + let mut value_resource_field_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field_ref => value_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mode => value_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_field_ref => value_resource_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DownwardAPIVolumeFile { + field_ref: value_field_ref, + mode: value_mode, + path: value_path.unwrap_or_default(), + resource_field_ref: value_resource_field_ref, + }) + } + } + + deserializer.deserialize_struct( + "DownwardAPIVolumeFile", + &[ + "fieldRef", + "mode", + "path", + "resourceFieldRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DownwardAPIVolumeFile { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DownwardAPIVolumeFile", + 1 + + self.field_ref.as_ref().map_or(0, |_| 1) + + self.mode.as_ref().map_or(0, |_| 1) + + self.resource_field_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.field_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldRef", value)?; + } + if let Some(value) = &self.mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mode", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.resource_field_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceFieldRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DownwardAPIVolumeFile { + fn schema_name() -> String { + "io.k8s.api.core.v1.DownwardAPIVolumeFile".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DownwardAPIVolumeFile represents information to create the file containing the pod field".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fieldRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required: Selects a field of the pod: only annotations, labels, name, namespace and uid are supported.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "mode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: mode bits used to set permissions on this file, must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceFieldRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/downward_api_volume_source.rs b/src/v1_30/api/core/v1/downward_api_volume_source.rs new file mode 100644 index 000000000..96b4ebb98 --- /dev/null +++ b/src/v1_30/api/core/v1/downward_api_volume_source.rs @@ -0,0 +1,157 @@ +// Generated from definition io.k8s.api.core.v1.DownwardAPIVolumeSource + +/// DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DownwardAPIVolumeSource { + /// Optional: mode bits to use on created files by default. Must be a Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub default_mode: Option, + + /// Items is a list of downward API volume file + pub items: Option>, +} + +impl crate::DeepMerge for DownwardAPIVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.default_mode, other.default_mode); + crate::merge_strategies::list::atomic(&mut self.items, other.items); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DownwardAPIVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default_mode, + Key_items, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "defaultMode" => Field::Key_default_mode, + "items" => Field::Key_items, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DownwardAPIVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DownwardAPIVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default_mode: Option = None; + let mut value_items: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default_mode => value_default_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DownwardAPIVolumeSource { + default_mode: value_default_mode, + items: value_items, + }) + } + } + + deserializer.deserialize_struct( + "DownwardAPIVolumeSource", + &[ + "defaultMode", + "items", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DownwardAPIVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DownwardAPIVolumeSource", + self.default_mode.as_ref().map_or(0, |_| 1) + + self.items.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultMode", value)?; + } + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DownwardAPIVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.DownwardAPIVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "defaultMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: mode bits to use on created files by default. Must be a Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Items is a list of downward API volume file".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/empty_dir_volume_source.rs b/src/v1_30/api/core/v1/empty_dir_volume_source.rs new file mode 100644 index 000000000..6fa685d96 --- /dev/null +++ b/src/v1_30/api/core/v1/empty_dir_volume_source.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.EmptyDirVolumeSource + +/// Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EmptyDirVolumeSource { + /// medium represents what type of storage medium should back this directory. The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pub medium: Option, + + /// sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pub size_limit: Option, +} + +impl crate::DeepMerge for EmptyDirVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.medium, other.medium); + crate::DeepMerge::merge_from(&mut self.size_limit, other.size_limit); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EmptyDirVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_medium, + Key_size_limit, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "medium" => Field::Key_medium, + "sizeLimit" => Field::Key_size_limit, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EmptyDirVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EmptyDirVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_medium: Option = None; + let mut value_size_limit: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_medium => value_medium = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_size_limit => value_size_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EmptyDirVolumeSource { + medium: value_medium, + size_limit: value_size_limit, + }) + } + } + + deserializer.deserialize_struct( + "EmptyDirVolumeSource", + &[ + "medium", + "sizeLimit", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EmptyDirVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EmptyDirVolumeSource", + self.medium.as_ref().map_or(0, |_| 1) + + self.size_limit.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.medium { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "medium", value)?; + } + if let Some(value) = &self.size_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sizeLimit", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EmptyDirVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.EmptyDirVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "medium".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("medium represents what type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "sizeLimit".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/endpoint_address.rs b/src/v1_30/api/core/v1/endpoint_address.rs new file mode 100644 index 000000000..2b1973af2 --- /dev/null +++ b/src/v1_30/api/core/v1/endpoint_address.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.core.v1.EndpointAddress + +/// EndpointAddress is a tuple that describes single IP address. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointAddress { + /// The Hostname of this endpoint + pub hostname: Option, + + /// The IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16). + pub ip: String, + + /// Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. + pub node_name: Option, + + /// Reference to object providing the endpoint. + pub target_ref: Option, +} + +impl crate::DeepMerge for EndpointAddress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.hostname, other.hostname); + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::DeepMerge::merge_from(&mut self.target_ref, other.target_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointAddress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hostname, + Key_ip, + Key_node_name, + Key_target_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hostname" => Field::Key_hostname, + "ip" => Field::Key_ip, + "nodeName" => Field::Key_node_name, + "targetRef" => Field::Key_target_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointAddress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointAddress") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hostname: Option = None; + let mut value_ip: Option = None; + let mut value_node_name: Option = None; + let mut value_target_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hostname => value_hostname = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_ref => value_target_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointAddress { + hostname: value_hostname, + ip: value_ip.unwrap_or_default(), + node_name: value_node_name, + target_ref: value_target_ref, + }) + } + } + + deserializer.deserialize_struct( + "EndpointAddress", + &[ + "hostname", + "ip", + "nodeName", + "targetRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointAddress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointAddress", + 1 + + self.hostname.as_ref().map_or(0, |_| 1) + + self.node_name.as_ref().map_or(0, |_| 1) + + self.target_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hostname { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostname", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", &self.ip)?; + if let Some(value) = &self.node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?; + } + if let Some(value) = &self.target_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointAddress { + fn schema_name() -> String { + "io.k8s.api.core.v1.EndpointAddress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointAddress is a tuple that describes single IP address.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hostname".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Hostname of this endpoint".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "targetRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Reference to object providing the endpoint.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "ip".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/endpoint_port.rs b/src/v1_30/api/core/v1/endpoint_port.rs new file mode 100644 index 000000000..892f24975 --- /dev/null +++ b/src/v1_30/api/core/v1/endpoint_port.rs @@ -0,0 +1,213 @@ +// Generated from definition io.k8s.api.core.v1.EndpointPort + +/// EndpointPort is a tuple that describes a single port. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointPort { + /// The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either: + /// + /// * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). + /// + /// * Kubernetes-defined prefixed names: + /// * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + /// * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + /// * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + /// + /// * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. + pub app_protocol: Option, + + /// The name of this port. This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined. + pub name: Option, + + /// The port number of the endpoint. + pub port: i32, + + /// The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP. + pub protocol: Option, +} + +impl crate::DeepMerge for EndpointPort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.app_protocol, other.app_protocol); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointPort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_app_protocol, + Key_name, + Key_port, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "appProtocol" => Field::Key_app_protocol, + "name" => Field::Key_name, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointPort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointPort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_app_protocol: Option = None; + let mut value_name: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_app_protocol => value_app_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointPort { + app_protocol: value_app_protocol, + name: value_name, + port: value_port.unwrap_or_default(), + protocol: value_protocol, + }) + } + } + + deserializer.deserialize_struct( + "EndpointPort", + &[ + "appProtocol", + "name", + "port", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointPort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointPort", + 1 + + self.app_protocol.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.protocol.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.app_protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "appProtocol", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + if let Some(value) = &self.protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointPort { + fn schema_name() -> String { + "io.k8s.api.core.v1.EndpointPort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointPort is a tuple that describes a single port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "appProtocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either:\n\n* Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names).\n\n* Kubernetes-defined prefixed names:\n * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-\n * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455\n * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455\n\n* Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of this port. This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The port number of the endpoint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/endpoint_subset.rs b/src/v1_30/api/core/v1/endpoint_subset.rs new file mode 100644 index 000000000..9400deda5 --- /dev/null +++ b/src/v1_30/api/core/v1/endpoint_subset.rs @@ -0,0 +1,199 @@ +// Generated from definition io.k8s.api.core.v1.EndpointSubset + +/// EndpointSubset is a group of addresses with a common set of ports. The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given: +/// +/// { +/// Addresses: \[{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}\], +/// Ports: \[{"name": "a", "port": 8675}, {"name": "b", "port": 309}\] +/// } +/// +/// The resulting set of endpoints can be viewed as: +/// +/// a: \[ 10.10.1.1:8675, 10.10.2.2:8675 \], +/// b: \[ 10.10.1.1:309, 10.10.2.2:309 \] +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointSubset { + /// IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize. + pub addresses: Option>, + + /// IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check. + pub not_ready_addresses: Option>, + + /// Port numbers available on the related IP addresses. + pub ports: Option>, +} + +impl crate::DeepMerge for EndpointSubset { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.addresses, other.addresses); + crate::merge_strategies::list::atomic(&mut self.not_ready_addresses, other.not_ready_addresses); + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointSubset { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_addresses, + Key_not_ready_addresses, + Key_ports, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "addresses" => Field::Key_addresses, + "notReadyAddresses" => Field::Key_not_ready_addresses, + "ports" => Field::Key_ports, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointSubset; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointSubset") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_addresses: Option> = None; + let mut value_not_ready_addresses: Option> = None; + let mut value_ports: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_addresses => value_addresses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_not_ready_addresses => value_not_ready_addresses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointSubset { + addresses: value_addresses, + not_ready_addresses: value_not_ready_addresses, + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + "EndpointSubset", + &[ + "addresses", + "notReadyAddresses", + "ports", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointSubset { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointSubset", + self.addresses.as_ref().map_or(0, |_| 1) + + self.not_ready_addresses.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.addresses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "addresses", value)?; + } + if let Some(value) = &self.not_ready_addresses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "notReadyAddresses", value)?; + } + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointSubset { + fn schema_name() -> String { + "io.k8s.api.core.v1.EndpointSubset".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointSubset is a group of addresses with a common set of ports. The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given:\n\n\t{\n\t Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n\t}\n\nThe resulting set of endpoints can be viewed as:\n\n\ta: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n\tb: [ 10.10.1.1:309, 10.10.2.2:309 ]".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "addresses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "notReadyAddresses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Port numbers available on the related IP addresses.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/endpoints.rs b/src/v1_30/api/core/v1/endpoints.rs new file mode 100644 index 000000000..3cb5e5642 --- /dev/null +++ b/src/v1_30/api/core/v1/endpoints.rs @@ -0,0 +1,236 @@ +// Generated from definition io.k8s.api.core.v1.Endpoints + +/// Endpoints is a collection of endpoints that implement the actual service. Example: +/// +/// Name: "mysvc", +/// Subsets: \[ +/// { +/// Addresses: \[{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}\], +/// Ports: \[{"name": "a", "port": 8675}, {"name": "b", "port": 309}\] +/// }, +/// { +/// Addresses: \[{"ip": "10.10.3.3"}\], +/// Ports: \[{"name": "a", "port": 93}, {"name": "b", "port": 76}\] +/// }, +/// \] +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Endpoints { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service. + pub subsets: Option>, +} + +impl crate::Resource for Endpoints { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Endpoints"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "endpoints"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Endpoints { + const LIST_KIND: &'static str = "EndpointsList"; +} + +impl crate::Metadata for Endpoints { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Endpoints { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.subsets, other.subsets); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Endpoints { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_subsets, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "subsets" => Field::Key_subsets, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Endpoints; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_subsets: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subsets => value_subsets = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Endpoints { + metadata: value_metadata.unwrap_or_default(), + subsets: value_subsets, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "subsets", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Endpoints { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.subsets.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.subsets { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subsets", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Endpoints { + fn schema_name() -> String { + "io.k8s.api.core.v1.Endpoints".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Endpoints is a collection of endpoints that implement the actual service. Example:\n\n\t Name: \"mysvc\",\n\t Subsets: [\n\t {\n\t Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n\t Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n\t },\n\t {\n\t Addresses: [{\"ip\": \"10.10.3.3\"}],\n\t Ports: [{\"name\": \"a\", \"port\": 93}, {\"name\": \"b\", \"port\": 76}]\n\t },\n\t]".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "subsets".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/env_from_source.rs b/src/v1_30/api/core/v1/env_from_source.rs new file mode 100644 index 000000000..3f27d3398 --- /dev/null +++ b/src/v1_30/api/core/v1/env_from_source.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.core.v1.EnvFromSource + +/// EnvFromSource represents the source of a set of ConfigMaps +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EnvFromSource { + /// The ConfigMap to select from + pub config_map_ref: Option, + + /// An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. + pub prefix: Option, + + /// The Secret to select from + pub secret_ref: Option, +} + +impl crate::DeepMerge for EnvFromSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.config_map_ref, other.config_map_ref); + crate::DeepMerge::merge_from(&mut self.prefix, other.prefix); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EnvFromSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_config_map_ref, + Key_prefix, + Key_secret_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "configMapRef" => Field::Key_config_map_ref, + "prefix" => Field::Key_prefix, + "secretRef" => Field::Key_secret_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EnvFromSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EnvFromSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_config_map_ref: Option = None; + let mut value_prefix: Option = None; + let mut value_secret_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_config_map_ref => value_config_map_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_prefix => value_prefix = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EnvFromSource { + config_map_ref: value_config_map_ref, + prefix: value_prefix, + secret_ref: value_secret_ref, + }) + } + } + + deserializer.deserialize_struct( + "EnvFromSource", + &[ + "configMapRef", + "prefix", + "secretRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EnvFromSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EnvFromSource", + self.config_map_ref.as_ref().map_or(0, |_| 1) + + self.prefix.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.config_map_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMapRef", value)?; + } + if let Some(value) = &self.prefix { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "prefix", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EnvFromSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.EnvFromSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EnvFromSource represents the source of a set of ConfigMaps".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "configMapRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The ConfigMap to select from".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "prefix".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Secret to select from".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/env_var.rs b/src/v1_30/api/core/v1/env_var.rs new file mode 100644 index 000000000..98d7b8650 --- /dev/null +++ b/src/v1_30/api/core/v1/env_var.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.core.v1.EnvVar + +/// EnvVar represents an environment variable present in a Container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EnvVar { + /// Name of the environment variable. Must be a C_IDENTIFIER. + pub name: String, + + /// Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "". + pub value: Option, + + /// Source for the environment variable's value. Cannot be used if value is not empty. + pub value_from: Option, +} + +impl crate::DeepMerge for EnvVar { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.value, other.value); + crate::DeepMerge::merge_from(&mut self.value_from, other.value_from); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EnvVar { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_value, + Key_value_from, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "value" => Field::Key_value, + "valueFrom" => Field::Key_value_from, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EnvVar; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EnvVar") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_value: Option = None; + let mut value_value_from: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value_from => value_value_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EnvVar { + name: value_name.unwrap_or_default(), + value: value_value, + value_from: value_value_from, + }) + } + } + + deserializer.deserialize_struct( + "EnvVar", + &[ + "name", + "value", + "valueFrom", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EnvVar { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EnvVar", + 1 + + self.value.as_ref().map_or(0, |_| 1) + + self.value_from.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + if let Some(value) = &self.value_from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "valueFrom", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EnvVar { + fn schema_name() -> String { + "io.k8s.api.core.v1.EnvVar".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EnvVar represents an environment variable present in a Container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the environment variable. Must be a C_IDENTIFIER.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "valueFrom".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Source for the environment variable's value. Cannot be used if value is not empty.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/env_var_source.rs b/src/v1_30/api/core/v1/env_var_source.rs new file mode 100644 index 000000000..9ee1065c6 --- /dev/null +++ b/src/v1_30/api/core/v1/env_var_source.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.EnvVarSource + +/// EnvVarSource represents a source for the value of an EnvVar. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EnvVarSource { + /// Selects a key of a ConfigMap. + pub config_map_key_ref: Option, + + /// Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels\['\'\]`, `metadata.annotations\['\'\]`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + pub field_ref: Option, + + /// Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + pub resource_field_ref: Option, + + /// Selects a key of a secret in the pod's namespace + pub secret_key_ref: Option, +} + +impl crate::DeepMerge for EnvVarSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.config_map_key_ref, other.config_map_key_ref); + crate::DeepMerge::merge_from(&mut self.field_ref, other.field_ref); + crate::DeepMerge::merge_from(&mut self.resource_field_ref, other.resource_field_ref); + crate::DeepMerge::merge_from(&mut self.secret_key_ref, other.secret_key_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EnvVarSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_config_map_key_ref, + Key_field_ref, + Key_resource_field_ref, + Key_secret_key_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "configMapKeyRef" => Field::Key_config_map_key_ref, + "fieldRef" => Field::Key_field_ref, + "resourceFieldRef" => Field::Key_resource_field_ref, + "secretKeyRef" => Field::Key_secret_key_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EnvVarSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EnvVarSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_config_map_key_ref: Option = None; + let mut value_field_ref: Option = None; + let mut value_resource_field_ref: Option = None; + let mut value_secret_key_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_config_map_key_ref => value_config_map_key_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_field_ref => value_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_field_ref => value_resource_field_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_key_ref => value_secret_key_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EnvVarSource { + config_map_key_ref: value_config_map_key_ref, + field_ref: value_field_ref, + resource_field_ref: value_resource_field_ref, + secret_key_ref: value_secret_key_ref, + }) + } + } + + deserializer.deserialize_struct( + "EnvVarSource", + &[ + "configMapKeyRef", + "fieldRef", + "resourceFieldRef", + "secretKeyRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EnvVarSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EnvVarSource", + self.config_map_key_ref.as_ref().map_or(0, |_| 1) + + self.field_ref.as_ref().map_or(0, |_| 1) + + self.resource_field_ref.as_ref().map_or(0, |_| 1) + + self.secret_key_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.config_map_key_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMapKeyRef", value)?; + } + if let Some(value) = &self.field_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldRef", value)?; + } + if let Some(value) = &self.resource_field_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceFieldRef", value)?; + } + if let Some(value) = &self.secret_key_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretKeyRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EnvVarSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.EnvVarSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EnvVarSource represents a source for the value of an EnvVar.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "configMapKeyRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a key of a ConfigMap.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "fieldRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceFieldRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "secretKeyRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selects a key of a secret in the pod's namespace".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/ephemeral_container.rs b/src/v1_30/api/core/v1/ephemeral_container.rs new file mode 100644 index 000000000..454ea7e64 --- /dev/null +++ b/src/v1_30/api/core/v1/ephemeral_container.rs @@ -0,0 +1,802 @@ +// Generated from definition io.k8s.api.core.v1.EphemeralContainer + +/// An EphemeralContainer is a temporary container that you may add to an existing Pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a Pod is removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the Pod to exceed its resource allocation. +/// +/// To add an ephemeral container, use the ephemeralcontainers subresource of an existing Pod. Ephemeral containers may not be removed or restarted. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EphemeralContainer { + /// Arguments to the entrypoint. The image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + pub args: Option>, + + /// Entrypoint array. Not executed within a shell. The image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + pub command: Option>, + + /// List of environment variables to set in the container. Cannot be updated. + pub env: Option>, + + /// List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated. + pub env_from: Option>, + + /// Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + pub image: Option, + + /// Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + pub image_pull_policy: Option, + + /// Lifecycle is not allowed for ephemeral containers. + pub lifecycle: Option, + + /// Probes are not allowed for ephemeral containers. + pub liveness_probe: Option, + + /// Name of the ephemeral container specified as a DNS_LABEL. This name must be unique among all containers, init containers and ephemeral containers. + pub name: String, + + /// Ports are not allowed for ephemeral containers. + pub ports: Option>, + + /// Probes are not allowed for ephemeral containers. + pub readiness_probe: Option, + + /// Resources resize policy for the container. + pub resize_policy: Option>, + + /// Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources already allocated to the pod. + pub resources: Option, + + /// Restart policy for the container to manage the restart behavior of each container within a pod. This may only be set for init containers. You cannot set this field on ephemeral containers. + pub restart_policy: Option, + + /// Optional: SecurityContext defines the security options the ephemeral container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + pub security_context: Option, + + /// Probes are not allowed for ephemeral containers. + pub startup_probe: Option, + + /// Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false. + pub stdin: Option, + + /// Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false + pub stdin_once: Option, + + /// If set, the name of the container from PodSpec that this ephemeral container targets. The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container uses the namespaces configured in the Pod spec. + /// + /// The container runtime must implement support for this feature. If the runtime does not support namespace targeting then the result of setting this field is undefined. + pub target_container_name: Option, + + /// Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated. + pub termination_message_path: Option, + + /// Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated. + pub termination_message_policy: Option, + + /// Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false. + pub tty: Option, + + /// volumeDevices is the list of block devices to be used by the container. + pub volume_devices: Option>, + + /// Pod volumes to mount into the container's filesystem. Subpath mounts are not allowed for ephemeral containers. Cannot be updated. + pub volume_mounts: Option>, + + /// Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated. + pub working_dir: Option, +} + +impl crate::DeepMerge for EphemeralContainer { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.args, other.args); + crate::merge_strategies::list::atomic(&mut self.command, other.command); + crate::merge_strategies::list::map( + &mut self.env, + other.env, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.env_from, other.env_from); + crate::DeepMerge::merge_from(&mut self.image, other.image); + crate::DeepMerge::merge_from(&mut self.image_pull_policy, other.image_pull_policy); + crate::DeepMerge::merge_from(&mut self.lifecycle, other.lifecycle); + crate::DeepMerge::merge_from(&mut self.liveness_probe, other.liveness_probe); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::merge_strategies::list::map( + &mut self.ports, + other.ports, + &[|lhs, rhs| lhs.container_port == rhs.container_port], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.readiness_probe, other.readiness_probe); + crate::merge_strategies::list::atomic(&mut self.resize_policy, other.resize_policy); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.restart_policy, other.restart_policy); + crate::DeepMerge::merge_from(&mut self.security_context, other.security_context); + crate::DeepMerge::merge_from(&mut self.startup_probe, other.startup_probe); + crate::DeepMerge::merge_from(&mut self.stdin, other.stdin); + crate::DeepMerge::merge_from(&mut self.stdin_once, other.stdin_once); + crate::DeepMerge::merge_from(&mut self.target_container_name, other.target_container_name); + crate::DeepMerge::merge_from(&mut self.termination_message_path, other.termination_message_path); + crate::DeepMerge::merge_from(&mut self.termination_message_policy, other.termination_message_policy); + crate::DeepMerge::merge_from(&mut self.tty, other.tty); + crate::merge_strategies::list::map( + &mut self.volume_devices, + other.volume_devices, + &[|lhs, rhs| lhs.device_path == rhs.device_path], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.volume_mounts, + other.volume_mounts, + &[|lhs, rhs| lhs.mount_path == rhs.mount_path], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.working_dir, other.working_dir); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EphemeralContainer { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_args, + Key_command, + Key_env, + Key_env_from, + Key_image, + Key_image_pull_policy, + Key_lifecycle, + Key_liveness_probe, + Key_name, + Key_ports, + Key_readiness_probe, + Key_resize_policy, + Key_resources, + Key_restart_policy, + Key_security_context, + Key_startup_probe, + Key_stdin, + Key_stdin_once, + Key_target_container_name, + Key_termination_message_path, + Key_termination_message_policy, + Key_tty, + Key_volume_devices, + Key_volume_mounts, + Key_working_dir, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "args" => Field::Key_args, + "command" => Field::Key_command, + "env" => Field::Key_env, + "envFrom" => Field::Key_env_from, + "image" => Field::Key_image, + "imagePullPolicy" => Field::Key_image_pull_policy, + "lifecycle" => Field::Key_lifecycle, + "livenessProbe" => Field::Key_liveness_probe, + "name" => Field::Key_name, + "ports" => Field::Key_ports, + "readinessProbe" => Field::Key_readiness_probe, + "resizePolicy" => Field::Key_resize_policy, + "resources" => Field::Key_resources, + "restartPolicy" => Field::Key_restart_policy, + "securityContext" => Field::Key_security_context, + "startupProbe" => Field::Key_startup_probe, + "stdin" => Field::Key_stdin, + "stdinOnce" => Field::Key_stdin_once, + "targetContainerName" => Field::Key_target_container_name, + "terminationMessagePath" => Field::Key_termination_message_path, + "terminationMessagePolicy" => Field::Key_termination_message_policy, + "tty" => Field::Key_tty, + "volumeDevices" => Field::Key_volume_devices, + "volumeMounts" => Field::Key_volume_mounts, + "workingDir" => Field::Key_working_dir, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EphemeralContainer; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EphemeralContainer") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_args: Option> = None; + let mut value_command: Option> = None; + let mut value_env: Option> = None; + let mut value_env_from: Option> = None; + let mut value_image: Option = None; + let mut value_image_pull_policy: Option = None; + let mut value_lifecycle: Option = None; + let mut value_liveness_probe: Option = None; + let mut value_name: Option = None; + let mut value_ports: Option> = None; + let mut value_readiness_probe: Option = None; + let mut value_resize_policy: Option> = None; + let mut value_resources: Option = None; + let mut value_restart_policy: Option = None; + let mut value_security_context: Option = None; + let mut value_startup_probe: Option = None; + let mut value_stdin: Option = None; + let mut value_stdin_once: Option = None; + let mut value_target_container_name: Option = None; + let mut value_termination_message_path: Option = None; + let mut value_termination_message_policy: Option = None; + let mut value_tty: Option = None; + let mut value_volume_devices: Option> = None; + let mut value_volume_mounts: Option> = None; + let mut value_working_dir: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_args => value_args = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_command => value_command = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_env => value_env = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_env_from => value_env_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image_pull_policy => value_image_pull_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lifecycle => value_lifecycle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_liveness_probe => value_liveness_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_readiness_probe => value_readiness_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resize_policy => value_resize_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_restart_policy => value_restart_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_security_context => value_security_context = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_startup_probe => value_startup_probe = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stdin => value_stdin = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stdin_once => value_stdin_once = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_container_name => value_target_container_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_message_path => value_termination_message_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_message_policy => value_termination_message_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tty => value_tty = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_devices => value_volume_devices = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_mounts => value_volume_mounts = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_working_dir => value_working_dir = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EphemeralContainer { + args: value_args, + command: value_command, + env: value_env, + env_from: value_env_from, + image: value_image, + image_pull_policy: value_image_pull_policy, + lifecycle: value_lifecycle, + liveness_probe: value_liveness_probe, + name: value_name.unwrap_or_default(), + ports: value_ports, + readiness_probe: value_readiness_probe, + resize_policy: value_resize_policy, + resources: value_resources, + restart_policy: value_restart_policy, + security_context: value_security_context, + startup_probe: value_startup_probe, + stdin: value_stdin, + stdin_once: value_stdin_once, + target_container_name: value_target_container_name, + termination_message_path: value_termination_message_path, + termination_message_policy: value_termination_message_policy, + tty: value_tty, + volume_devices: value_volume_devices, + volume_mounts: value_volume_mounts, + working_dir: value_working_dir, + }) + } + } + + deserializer.deserialize_struct( + "EphemeralContainer", + &[ + "args", + "command", + "env", + "envFrom", + "image", + "imagePullPolicy", + "lifecycle", + "livenessProbe", + "name", + "ports", + "readinessProbe", + "resizePolicy", + "resources", + "restartPolicy", + "securityContext", + "startupProbe", + "stdin", + "stdinOnce", + "targetContainerName", + "terminationMessagePath", + "terminationMessagePolicy", + "tty", + "volumeDevices", + "volumeMounts", + "workingDir", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EphemeralContainer { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EphemeralContainer", + 1 + + self.args.as_ref().map_or(0, |_| 1) + + self.command.as_ref().map_or(0, |_| 1) + + self.env.as_ref().map_or(0, |_| 1) + + self.env_from.as_ref().map_or(0, |_| 1) + + self.image.as_ref().map_or(0, |_| 1) + + self.image_pull_policy.as_ref().map_or(0, |_| 1) + + self.lifecycle.as_ref().map_or(0, |_| 1) + + self.liveness_probe.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1) + + self.readiness_probe.as_ref().map_or(0, |_| 1) + + self.resize_policy.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.restart_policy.as_ref().map_or(0, |_| 1) + + self.security_context.as_ref().map_or(0, |_| 1) + + self.startup_probe.as_ref().map_or(0, |_| 1) + + self.stdin.as_ref().map_or(0, |_| 1) + + self.stdin_once.as_ref().map_or(0, |_| 1) + + self.target_container_name.as_ref().map_or(0, |_| 1) + + self.termination_message_path.as_ref().map_or(0, |_| 1) + + self.termination_message_policy.as_ref().map_or(0, |_| 1) + + self.tty.as_ref().map_or(0, |_| 1) + + self.volume_devices.as_ref().map_or(0, |_| 1) + + self.volume_mounts.as_ref().map_or(0, |_| 1) + + self.working_dir.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.args { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "args", value)?; + } + if let Some(value) = &self.command { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "command", value)?; + } + if let Some(value) = &self.env { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "env", value)?; + } + if let Some(value) = &self.env_from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "envFrom", value)?; + } + if let Some(value) = &self.image { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", value)?; + } + if let Some(value) = &self.image_pull_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "imagePullPolicy", value)?; + } + if let Some(value) = &self.lifecycle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lifecycle", value)?; + } + if let Some(value) = &self.liveness_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "livenessProbe", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + if let Some(value) = &self.readiness_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readinessProbe", value)?; + } + if let Some(value) = &self.resize_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resizePolicy", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.restart_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "restartPolicy", value)?; + } + if let Some(value) = &self.security_context { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "securityContext", value)?; + } + if let Some(value) = &self.startup_probe { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startupProbe", value)?; + } + if let Some(value) = &self.stdin { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stdin", value)?; + } + if let Some(value) = &self.stdin_once { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stdinOnce", value)?; + } + if let Some(value) = &self.target_container_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetContainerName", value)?; + } + if let Some(value) = &self.termination_message_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationMessagePath", value)?; + } + if let Some(value) = &self.termination_message_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationMessagePolicy", value)?; + } + if let Some(value) = &self.tty { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tty", value)?; + } + if let Some(value) = &self.volume_devices { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeDevices", value)?; + } + if let Some(value) = &self.volume_mounts { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMounts", value)?; + } + if let Some(value) = &self.working_dir { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "workingDir", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EphemeralContainer { + fn schema_name() -> String { + "io.k8s.api.core.v1.EphemeralContainer".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An EphemeralContainer is a temporary container that you may add to an existing Pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a Pod is removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the Pod to exceed its resource allocation.\n\nTo add an ephemeral container, use the ephemeralcontainers subresource of an existing Pod. Ephemeral containers may not be removed or restarted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "args".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Arguments to the entrypoint. The image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "command".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Entrypoint array. Not executed within a shell. The image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "env".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of environment variables to set in the container. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "envFrom".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container image name. More info: https://kubernetes.io/docs/concepts/containers/images".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "imagePullPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lifecycle".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Lifecycle is not allowed for ephemeral containers.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "livenessProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Probes are not allowed for ephemeral containers.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the ephemeral container specified as a DNS_LABEL. This name must be unique among all containers, init containers and ephemeral containers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ports are not allowed for ephemeral containers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readinessProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Probes are not allowed for ephemeral containers.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resizePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources resize policy for the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources already allocated to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "restartPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Restart policy for the container to manage the restart behavior of each container within a pod. This may only be set for init containers. You cannot set this field on ephemeral containers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "securityContext".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: SecurityContext defines the security options the ephemeral container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "startupProbe".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Probes are not allowed for ephemeral containers.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "stdin".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "stdinOnce".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "targetContainerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If set, the name of the container from PodSpec that this ephemeral container targets. The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container uses the namespaces configured in the Pod spec.\n\nThe container runtime must implement support for this feature. If the runtime does not support namespace targeting then the result of setting this field is undefined.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "terminationMessagePath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "terminationMessagePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "tty".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeDevices".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeDevices is the list of block devices to be used by the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumeMounts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Pod volumes to mount into the container's filesystem. Subpath mounts are not allowed for ephemeral containers. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "workingDir".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/ephemeral_volume_source.rs b/src/v1_30/api/core/v1/ephemeral_volume_source.rs new file mode 100644 index 000000000..3bdcc4023 --- /dev/null +++ b/src/v1_30/api/core/v1/ephemeral_volume_source.rs @@ -0,0 +1,133 @@ +// Generated from definition io.k8s.api.core.v1.EphemeralVolumeSource + +/// Represents an ephemeral volume that is handled by a normal storage driver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EphemeralVolumeSource { + /// Will be used to create a stand-alone PVC to provision the volume. The pod in which this EphemeralVolumeSource is embedded will be the owner of the PVC, i.e. the PVC will be deleted together with the pod. The name of the PVC will be `\-\` where `\` is the name from the `PodSpec.Volumes` array entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). + /// + /// An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until the unrelated PVC is removed. If such a pre-created PVC is meant to be used by the pod, the PVC has to updated with an owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. + /// + /// This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. + /// + /// Required, must not be nil. + pub volume_claim_template: Option, +} + +impl crate::DeepMerge for EphemeralVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.volume_claim_template, other.volume_claim_template); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EphemeralVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_volume_claim_template, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "volumeClaimTemplate" => Field::Key_volume_claim_template, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EphemeralVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EphemeralVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_volume_claim_template: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_volume_claim_template => value_volume_claim_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EphemeralVolumeSource { + volume_claim_template: value_volume_claim_template, + }) + } + } + + deserializer.deserialize_struct( + "EphemeralVolumeSource", + &[ + "volumeClaimTemplate", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EphemeralVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EphemeralVolumeSource", + self.volume_claim_template.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.volume_claim_template { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeClaimTemplate", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EphemeralVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.EphemeralVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents an ephemeral volume that is handled by a normal storage driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "volumeClaimTemplate".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Will be used to create a stand-alone PVC to provision the volume. The pod in which this EphemeralVolumeSource is embedded will be the owner of the PVC, i.e. the PVC will be deleted together with the pod. The name of the PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long).\n\nAn existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until the unrelated PVC is removed. If such a pre-created PVC is meant to be used by the pod, the PVC has to updated with an owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster.\n\nThis field is read-only and no changes will be made by Kubernetes to the PVC after it has been created.\n\nRequired, must not be nil.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/event.rs b/src/v1_30/api/core/v1/event.rs new file mode 100644 index 000000000..6397f0bd8 --- /dev/null +++ b/src/v1_30/api/core/v1/event.rs @@ -0,0 +1,544 @@ +// Generated from definition io.k8s.api.core.v1.Event + +/// Event is a report of an event somewhere in the cluster. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Event { + /// What action was taken/failed regarding to the Regarding object. + pub action: Option, + + /// The number of times this event has occurred. + pub count: Option, + + /// Time when this Event was first observed. + pub event_time: Option, + + /// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.) + pub first_timestamp: Option, + + /// The object that this event is about. + pub involved_object: crate::api::core::v1::ObjectReference, + + /// The time at which the most recent occurrence of this event was recorded. + pub last_timestamp: Option, + + /// A human-readable description of the status of this operation. + pub message: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// This should be a short, machine understandable string that gives the reason for the transition into the object's current status. + pub reason: Option, + + /// Optional secondary object for more complex actions. + pub related: Option, + + /// Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. + pub reporting_component: Option, + + /// ID of the controller instance, e.g. `kubelet-xyzf`. + pub reporting_instance: Option, + + /// Data about the Event series this event represents or nil if it's a singleton Event. + pub series: Option, + + /// The component reporting this event. Should be a short machine understandable string. + pub source: Option, + + /// Type of this event (Normal, Warning), new types could be added in the future + pub type_: Option, +} + +impl crate::Resource for Event { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Event"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "events"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Event { + const LIST_KIND: &'static str = "EventList"; +} + +impl crate::Metadata for Event { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Event { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.action, other.action); + crate::DeepMerge::merge_from(&mut self.count, other.count); + crate::DeepMerge::merge_from(&mut self.event_time, other.event_time); + crate::DeepMerge::merge_from(&mut self.first_timestamp, other.first_timestamp); + crate::DeepMerge::merge_from(&mut self.involved_object, other.involved_object); + crate::DeepMerge::merge_from(&mut self.last_timestamp, other.last_timestamp); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.related, other.related); + crate::DeepMerge::merge_from(&mut self.reporting_component, other.reporting_component); + crate::DeepMerge::merge_from(&mut self.reporting_instance, other.reporting_instance); + crate::DeepMerge::merge_from(&mut self.series, other.series); + crate::DeepMerge::merge_from(&mut self.source, other.source); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_action, + Key_count, + Key_event_time, + Key_first_timestamp, + Key_involved_object, + Key_last_timestamp, + Key_message, + Key_metadata, + Key_reason, + Key_related, + Key_reporting_component, + Key_reporting_instance, + Key_series, + Key_source, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "action" => Field::Key_action, + "count" => Field::Key_count, + "eventTime" => Field::Key_event_time, + "firstTimestamp" => Field::Key_first_timestamp, + "involvedObject" => Field::Key_involved_object, + "lastTimestamp" => Field::Key_last_timestamp, + "message" => Field::Key_message, + "metadata" => Field::Key_metadata, + "reason" => Field::Key_reason, + "related" => Field::Key_related, + "reportingComponent" => Field::Key_reporting_component, + "reportingInstance" => Field::Key_reporting_instance, + "series" => Field::Key_series, + "source" => Field::Key_source, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Event; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_action: Option = None; + let mut value_count: Option = None; + let mut value_event_time: Option = None; + let mut value_first_timestamp: Option = None; + let mut value_involved_object: Option = None; + let mut value_last_timestamp: Option = None; + let mut value_message: Option = None; + let mut value_metadata: Option = None; + let mut value_reason: Option = None; + let mut value_related: Option = None; + let mut value_reporting_component: Option = None; + let mut value_reporting_instance: Option = None; + let mut value_series: Option = None; + let mut value_source: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_action => value_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_count => value_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_event_time => value_event_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_first_timestamp => value_first_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_involved_object => value_involved_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_timestamp => value_last_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_related => value_related = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reporting_component => value_reporting_component = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reporting_instance => value_reporting_instance = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_series => value_series = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_source => value_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Event { + action: value_action, + count: value_count, + event_time: value_event_time, + first_timestamp: value_first_timestamp, + involved_object: value_involved_object.unwrap_or_default(), + last_timestamp: value_last_timestamp, + message: value_message, + metadata: value_metadata.unwrap_or_default(), + reason: value_reason, + related: value_related, + reporting_component: value_reporting_component, + reporting_instance: value_reporting_instance, + series: value_series, + source: value_source, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "action", + "count", + "eventTime", + "firstTimestamp", + "involvedObject", + "lastTimestamp", + "message", + "metadata", + "reason", + "related", + "reportingComponent", + "reportingInstance", + "series", + "source", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Event { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.action.as_ref().map_or(0, |_| 1) + + self.count.as_ref().map_or(0, |_| 1) + + self.event_time.as_ref().map_or(0, |_| 1) + + self.first_timestamp.as_ref().map_or(0, |_| 1) + + self.last_timestamp.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.related.as_ref().map_or(0, |_| 1) + + self.reporting_component.as_ref().map_or(0, |_| 1) + + self.reporting_instance.as_ref().map_or(0, |_| 1) + + self.series.as_ref().map_or(0, |_| 1) + + self.source.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.action { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "action", value)?; + } + if let Some(value) = &self.count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "count", value)?; + } + if let Some(value) = &self.event_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "eventTime", value)?; + } + if let Some(value) = &self.first_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "firstTimestamp", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "involvedObject", &self.involved_object)?; + if let Some(value) = &self.last_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTimestamp", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.related { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "related", value)?; + } + if let Some(value) = &self.reporting_component { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reportingComponent", value)?; + } + if let Some(value) = &self.reporting_instance { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reportingInstance", value)?; + } + if let Some(value) = &self.series { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "series", value)?; + } + if let Some(value) = &self.source { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "source", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Event { + fn schema_name() -> String { + "io.k8s.api.core.v1.Event".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Event is a report of an event somewhere in the cluster. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "action".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("What action was taken/failed regarding to the Regarding object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "count".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of times this event has occurred.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "eventTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time when this Event was first observed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "firstTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "involvedObject".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The object that this event is about.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lastTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The time at which the most recent occurrence of this event was recorded.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human-readable description of the status of this operation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("This should be a short, machine understandable string that gives the reason for the transition into the object's current status.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "related".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional secondary object for more complex actions.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "reportingComponent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reportingInstance".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ID of the controller instance, e.g. `kubelet-xyzf`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "series".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Data about the Event series this event represents or nil if it's a singleton Event.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "source".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The component reporting this event. Should be a short machine understandable string.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of this event (Normal, Warning), new types could be added in the future".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "involvedObject".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/event_series.rs b/src/v1_30/api/core/v1/event_series.rs new file mode 100644 index 000000000..f28edcbb9 --- /dev/null +++ b/src/v1_30/api/core/v1/event_series.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.EventSeries + +/// EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EventSeries { + /// Number of occurrences in this series up to the last heartbeat time + pub count: Option, + + /// Time of the last occurrence observed + pub last_observed_time: Option, +} + +impl crate::DeepMerge for EventSeries { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.count, other.count); + crate::DeepMerge::merge_from(&mut self.last_observed_time, other.last_observed_time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EventSeries { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_count, + Key_last_observed_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "count" => Field::Key_count, + "lastObservedTime" => Field::Key_last_observed_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EventSeries; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EventSeries") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_count: Option = None; + let mut value_last_observed_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_count => value_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_observed_time => value_last_observed_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EventSeries { + count: value_count, + last_observed_time: value_last_observed_time, + }) + } + } + + deserializer.deserialize_struct( + "EventSeries", + &[ + "count", + "lastObservedTime", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EventSeries { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EventSeries", + self.count.as_ref().map_or(0, |_| 1) + + self.last_observed_time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "count", value)?; + } + if let Some(value) = &self.last_observed_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastObservedTime", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EventSeries { + fn schema_name() -> String { + "io.k8s.api.core.v1.EventSeries".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "count".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of occurrences in this series up to the last heartbeat time".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lastObservedTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time of the last occurrence observed".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/event_source.rs b/src/v1_30/api/core/v1/event_source.rs new file mode 100644 index 000000000..16e80db56 --- /dev/null +++ b/src/v1_30/api/core/v1/event_source.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.EventSource + +/// EventSource contains information for an event. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EventSource { + /// Component from which the event is generated. + pub component: Option, + + /// Node name on which the event is generated. + pub host: Option, +} + +impl crate::DeepMerge for EventSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.component, other.component); + crate::DeepMerge::merge_from(&mut self.host, other.host); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EventSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_component, + Key_host, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "component" => Field::Key_component, + "host" => Field::Key_host, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EventSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EventSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_component: Option = None; + let mut value_host: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_component => value_component = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host => value_host = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EventSource { + component: value_component, + host: value_host, + }) + } + } + + deserializer.deserialize_struct( + "EventSource", + &[ + "component", + "host", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EventSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EventSource", + self.component.as_ref().map_or(0, |_| 1) + + self.host.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.component { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "component", value)?; + } + if let Some(value) = &self.host { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "host", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EventSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.EventSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EventSource contains information for an event.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "component".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Component from which the event is generated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "host".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Node name on which the event is generated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/exec_action.rs b/src/v1_30/api/core/v1/exec_action.rs new file mode 100644 index 000000000..07e888786 --- /dev/null +++ b/src/v1_30/api/core/v1/exec_action.rs @@ -0,0 +1,136 @@ +// Generated from definition io.k8s.api.core.v1.ExecAction + +/// ExecAction describes a "run in container" action. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExecAction { + /// Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + pub command: Option>, +} + +impl crate::DeepMerge for ExecAction { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.command, other.command); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExecAction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_command, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "command" => Field::Key_command, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExecAction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExecAction") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_command: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_command => value_command = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExecAction { + command: value_command, + }) + } + } + + deserializer.deserialize_struct( + "ExecAction", + &[ + "command", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExecAction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExecAction", + self.command.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.command { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "command", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExecAction { + fn schema_name() -> String { + "io.k8s.api.core.v1.ExecAction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExecAction describes a \"run in container\" action.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "command".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/fc_volume_source.rs b/src/v1_30/api/core/v1/fc_volume_source.rs new file mode 100644 index 000000000..f379368e1 --- /dev/null +++ b/src/v1_30/api/core/v1/fc_volume_source.rs @@ -0,0 +1,246 @@ +// Generated from definition io.k8s.api.core.v1.FCVolumeSource + +/// Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FCVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// lun is Optional: FC target lun number + pub lun: Option, + + /// readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// targetWWNs is Optional: FC target worldwide names (WWNs) + pub target_wwns: Option>, + + /// wwids Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + pub wwids: Option>, +} + +impl crate::DeepMerge for FCVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.lun, other.lun); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::merge_strategies::list::atomic(&mut self.target_wwns, other.target_wwns); + crate::merge_strategies::list::atomic(&mut self.wwids, other.wwids); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FCVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_lun, + Key_read_only, + Key_target_wwns, + Key_wwids, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "lun" => Field::Key_lun, + "readOnly" => Field::Key_read_only, + "targetWWNs" => Field::Key_target_wwns, + "wwids" => Field::Key_wwids, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FCVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FCVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_lun: Option = None; + let mut value_read_only: Option = None; + let mut value_target_wwns: Option> = None; + let mut value_wwids: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lun => value_lun = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_wwns => value_target_wwns = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_wwids => value_wwids = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FCVolumeSource { + fs_type: value_fs_type, + lun: value_lun, + read_only: value_read_only, + target_wwns: value_target_wwns, + wwids: value_wwids, + }) + } + } + + deserializer.deserialize_struct( + "FCVolumeSource", + &[ + "fsType", + "lun", + "readOnly", + "targetWWNs", + "wwids", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FCVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FCVolumeSource", + self.fs_type.as_ref().map_or(0, |_| 1) + + self.lun.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.target_wwns.as_ref().map_or(0, |_| 1) + + self.wwids.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.lun { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lun", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.target_wwns { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetWWNs", value)?; + } + if let Some(value) = &self.wwids { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "wwids", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FCVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.FCVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lun".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lun is Optional: FC target lun number".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "targetWWNs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetWWNs is Optional: FC target worldwide names (WWNs)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "wwids".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("wwids Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/flex_persistent_volume_source.rs b/src/v1_30/api/core/v1/flex_persistent_volume_source.rs new file mode 100644 index 000000000..a696df849 --- /dev/null +++ b/src/v1_30/api/core/v1/flex_persistent_volume_source.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.core.v1.FlexPersistentVolumeSource + +/// FlexPersistentVolumeSource represents a generic persistent volume resource that is provisioned/attached using an exec based plugin. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlexPersistentVolumeSource { + /// driver is the name of the driver to use for this volume. + pub driver: String, + + /// fsType is the Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + pub fs_type: Option, + + /// options is Optional: this field holds extra command options if any. + pub options: Option>, + + /// readOnly is Optional: defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef is Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts. + pub secret_ref: Option, +} + +impl crate::DeepMerge for FlexPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver, other.driver); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::merge_strategies::map::granular(&mut self.options, other.options, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlexPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver, + Key_fs_type, + Key_options, + Key_read_only, + Key_secret_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driver" => Field::Key_driver, + "fsType" => Field::Key_fs_type, + "options" => Field::Key_options, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlexPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlexPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver: Option = None; + let mut value_fs_type: Option = None; + let mut value_options: Option> = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver => value_driver = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_options => value_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlexPersistentVolumeSource { + driver: value_driver.unwrap_or_default(), + fs_type: value_fs_type, + options: value_options, + read_only: value_read_only, + secret_ref: value_secret_ref, + }) + } + } + + deserializer.deserialize_struct( + "FlexPersistentVolumeSource", + &[ + "driver", + "fsType", + "options", + "readOnly", + "secretRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlexPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlexPersistentVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.options.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driver", &self.driver)?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "options", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlexPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.FlexPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlexPersistentVolumeSource represents a generic persistent volume resource that is provisioned/attached using an exec based plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driver".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("driver is the name of the driver to use for this volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "options".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("options is Optional: this field holds extra command options if any.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "driver".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/flex_volume_source.rs b/src/v1_30/api/core/v1/flex_volume_source.rs new file mode 100644 index 000000000..8cec76378 --- /dev/null +++ b/src/v1_30/api/core/v1/flex_volume_source.rs @@ -0,0 +1,239 @@ +// Generated from definition io.k8s.api.core.v1.FlexVolumeSource + +/// FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlexVolumeSource { + /// driver is the name of the driver to use for this volume. + pub driver: String, + + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + pub fs_type: Option, + + /// options is Optional: this field holds extra command options if any. + pub options: Option>, + + /// readOnly is Optional: defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef is Optional: secretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts. + pub secret_ref: Option, +} + +impl crate::DeepMerge for FlexVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver, other.driver); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::merge_strategies::map::granular(&mut self.options, other.options, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlexVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver, + Key_fs_type, + Key_options, + Key_read_only, + Key_secret_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driver" => Field::Key_driver, + "fsType" => Field::Key_fs_type, + "options" => Field::Key_options, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlexVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlexVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver: Option = None; + let mut value_fs_type: Option = None; + let mut value_options: Option> = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver => value_driver = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_options => value_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlexVolumeSource { + driver: value_driver.unwrap_or_default(), + fs_type: value_fs_type, + options: value_options, + read_only: value_read_only, + secret_ref: value_secret_ref, + }) + } + } + + deserializer.deserialize_struct( + "FlexVolumeSource", + &[ + "driver", + "fsType", + "options", + "readOnly", + "secretRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlexVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlexVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.options.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driver", &self.driver)?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "options", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlexVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.FlexVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driver".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("driver is the name of the driver to use for this volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "options".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("options is Optional: this field holds extra command options if any.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly is Optional: defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is Optional: secretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "driver".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/flocker_volume_source.rs b/src/v1_30/api/core/v1/flocker_volume_source.rs new file mode 100644 index 000000000..fbdbeb717 --- /dev/null +++ b/src/v1_30/api/core/v1/flocker_volume_source.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.FlockerVolumeSource + +/// Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlockerVolumeSource { + /// datasetName is Name of the dataset stored as metadata -\> name on the dataset for Flocker should be considered as deprecated + pub dataset_name: Option, + + /// datasetUUID is the UUID of the dataset. This is unique identifier of a Flocker dataset + pub dataset_uuid: Option, +} + +impl crate::DeepMerge for FlockerVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.dataset_name, other.dataset_name); + crate::DeepMerge::merge_from(&mut self.dataset_uuid, other.dataset_uuid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlockerVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_dataset_name, + Key_dataset_uuid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "datasetName" => Field::Key_dataset_name, + "datasetUUID" => Field::Key_dataset_uuid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlockerVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlockerVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_dataset_name: Option = None; + let mut value_dataset_uuid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_dataset_name => value_dataset_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_dataset_uuid => value_dataset_uuid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlockerVolumeSource { + dataset_name: value_dataset_name, + dataset_uuid: value_dataset_uuid, + }) + } + } + + deserializer.deserialize_struct( + "FlockerVolumeSource", + &[ + "datasetName", + "datasetUUID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlockerVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlockerVolumeSource", + self.dataset_name.as_ref().map_or(0, |_| 1) + + self.dataset_uuid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.dataset_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "datasetName", value)?; + } + if let Some(value) = &self.dataset_uuid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "datasetUUID", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlockerVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.FlockerVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "datasetName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "datasetUUID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("datasetUUID is the UUID of the dataset. This is unique identifier of a Flocker dataset".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/gce_persistent_disk_volume_source.rs b/src/v1_30/api/core/v1/gce_persistent_disk_volume_source.rs new file mode 100644 index 000000000..8b8951cac --- /dev/null +++ b/src/v1_30/api/core/v1/gce_persistent_disk_volume_source.rs @@ -0,0 +1,206 @@ +// Generated from definition io.k8s.api.core.v1.GCEPersistentDiskVolumeSource + +/// Represents a Persistent Disk resource in Google Compute Engine. +/// +/// A GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GCEPersistentDiskVolumeSource { + /// fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub fs_type: Option, + + /// partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub partition: Option, + + /// pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub pd_name: String, + + /// readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub read_only: Option, +} + +impl crate::DeepMerge for GCEPersistentDiskVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.partition, other.partition); + crate::DeepMerge::merge_from(&mut self.pd_name, other.pd_name); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GCEPersistentDiskVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_partition, + Key_pd_name, + Key_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "partition" => Field::Key_partition, + "pdName" => Field::Key_pd_name, + "readOnly" => Field::Key_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GCEPersistentDiskVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GCEPersistentDiskVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_partition: Option = None; + let mut value_pd_name: Option = None; + let mut value_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_partition => value_partition = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pd_name => value_pd_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GCEPersistentDiskVolumeSource { + fs_type: value_fs_type, + partition: value_partition, + pd_name: value_pd_name.unwrap_or_default(), + read_only: value_read_only, + }) + } + } + + deserializer.deserialize_struct( + "GCEPersistentDiskVolumeSource", + &[ + "fsType", + "partition", + "pdName", + "readOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GCEPersistentDiskVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GCEPersistentDiskVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.partition.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.partition { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "partition", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pdName", &self.pd_name)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GCEPersistentDiskVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.GCEPersistentDiskVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "partition".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "pdName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "pdName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/git_repo_volume_source.rs b/src/v1_30/api/core/v1/git_repo_volume_source.rs new file mode 100644 index 000000000..5af2e332f --- /dev/null +++ b/src/v1_30/api/core/v1/git_repo_volume_source.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.core.v1.GitRepoVolumeSource + +/// Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling. +/// +/// DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GitRepoVolumeSource { + /// directory is the target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. + pub directory: Option, + + /// repository is the URL + pub repository: String, + + /// revision is the commit hash for the specified revision. + pub revision: Option, +} + +impl crate::DeepMerge for GitRepoVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.directory, other.directory); + crate::DeepMerge::merge_from(&mut self.repository, other.repository); + crate::DeepMerge::merge_from(&mut self.revision, other.revision); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GitRepoVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_directory, + Key_repository, + Key_revision, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "directory" => Field::Key_directory, + "repository" => Field::Key_repository, + "revision" => Field::Key_revision, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GitRepoVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GitRepoVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_directory: Option = None; + let mut value_repository: Option = None; + let mut value_revision: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_directory => value_directory = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_repository => value_repository = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_revision => value_revision = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GitRepoVolumeSource { + directory: value_directory, + repository: value_repository.unwrap_or_default(), + revision: value_revision, + }) + } + } + + deserializer.deserialize_struct( + "GitRepoVolumeSource", + &[ + "directory", + "repository", + "revision", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GitRepoVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GitRepoVolumeSource", + 1 + + self.directory.as_ref().map_or(0, |_| 1) + + self.revision.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.directory { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "directory", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "repository", &self.repository)?; + if let Some(value) = &self.revision { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "revision", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GitRepoVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.GitRepoVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.\n\nDEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "directory".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("directory is the target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "repository".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("repository is the URL".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "revision".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("revision is the commit hash for the specified revision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "repository".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/glusterfs_persistent_volume_source.rs b/src/v1_30/api/core/v1/glusterfs_persistent_volume_source.rs new file mode 100644 index 000000000..88c214613 --- /dev/null +++ b/src/v1_30/api/core/v1/glusterfs_persistent_volume_source.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.core.v1.GlusterfsPersistentVolumeSource + +/// Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GlusterfsPersistentVolumeSource { + /// endpoints is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub endpoints: String, + + /// endpointsNamespace is the namespace that contains Glusterfs endpoint. If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub endpoints_namespace: Option, + + /// path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub path: String, + + /// readOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub read_only: Option, +} + +impl crate::DeepMerge for GlusterfsPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.endpoints, other.endpoints); + crate::DeepMerge::merge_from(&mut self.endpoints_namespace, other.endpoints_namespace); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GlusterfsPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_endpoints, + Key_endpoints_namespace, + Key_path, + Key_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "endpoints" => Field::Key_endpoints, + "endpointsNamespace" => Field::Key_endpoints_namespace, + "path" => Field::Key_path, + "readOnly" => Field::Key_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GlusterfsPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GlusterfsPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_endpoints: Option = None; + let mut value_endpoints_namespace: Option = None; + let mut value_path: Option = None; + let mut value_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_endpoints => value_endpoints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_endpoints_namespace => value_endpoints_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GlusterfsPersistentVolumeSource { + endpoints: value_endpoints.unwrap_or_default(), + endpoints_namespace: value_endpoints_namespace, + path: value_path.unwrap_or_default(), + read_only: value_read_only, + }) + } + } + + deserializer.deserialize_struct( + "GlusterfsPersistentVolumeSource", + &[ + "endpoints", + "endpointsNamespace", + "path", + "readOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GlusterfsPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GlusterfsPersistentVolumeSource", + 2 + + self.endpoints_namespace.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "endpoints", &self.endpoints)?; + if let Some(value) = &self.endpoints_namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "endpointsNamespace", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GlusterfsPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.GlusterfsPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "endpoints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("endpoints is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "endpointsNamespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("endpointsNamespace is the namespace that contains Glusterfs endpoint. If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "endpoints".to_owned(), + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/glusterfs_volume_source.rs b/src/v1_30/api/core/v1/glusterfs_volume_source.rs new file mode 100644 index 000000000..ab4e62c2a --- /dev/null +++ b/src/v1_30/api/core/v1/glusterfs_volume_source.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.core.v1.GlusterfsVolumeSource + +/// Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GlusterfsVolumeSource { + /// endpoints is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub endpoints: String, + + /// path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub path: String, + + /// readOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + pub read_only: Option, +} + +impl crate::DeepMerge for GlusterfsVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.endpoints, other.endpoints); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GlusterfsVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_endpoints, + Key_path, + Key_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "endpoints" => Field::Key_endpoints, + "path" => Field::Key_path, + "readOnly" => Field::Key_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GlusterfsVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GlusterfsVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_endpoints: Option = None; + let mut value_path: Option = None; + let mut value_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_endpoints => value_endpoints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GlusterfsVolumeSource { + endpoints: value_endpoints.unwrap_or_default(), + path: value_path.unwrap_or_default(), + read_only: value_read_only, + }) + } + } + + deserializer.deserialize_struct( + "GlusterfsVolumeSource", + &[ + "endpoints", + "path", + "readOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GlusterfsVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GlusterfsVolumeSource", + 2 + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "endpoints", &self.endpoints)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GlusterfsVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.GlusterfsVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "endpoints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("endpoints is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "endpoints".to_owned(), + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/grpc_action.rs b/src/v1_30/api/core/v1/grpc_action.rs new file mode 100644 index 000000000..b339c61c8 --- /dev/null +++ b/src/v1_30/api/core/v1/grpc_action.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.GRPCAction + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GRPCAction { + /// Port number of the gRPC service. Number must be in the range 1 to 65535. + pub port: i32, + + /// Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + /// + /// If this is not specified, the default behavior is defined by gRPC. + pub service: Option, +} + +impl crate::DeepMerge for GRPCAction { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.service, other.service); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GRPCAction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_port, + Key_service, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "port" => Field::Key_port, + "service" => Field::Key_service, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GRPCAction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GRPCAction") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_port: Option = None; + let mut value_service: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GRPCAction { + port: value_port.unwrap_or_default(), + service: value_service, + }) + } + } + + deserializer.deserialize_struct( + "GRPCAction", + &[ + "port", + "service", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GRPCAction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GRPCAction", + 1 + + self.service.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + if let Some(value) = &self.service { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GRPCAction { + fn schema_name() -> String { + "io.k8s.api.core.v1.GRPCAction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Port number of the gRPC service. Number must be in the range 1 to 65535.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "service".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).\n\nIf this is not specified, the default behavior is defined by gRPC.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/host_alias.rs b/src/v1_30/api/core/v1/host_alias.rs new file mode 100644 index 000000000..8ea648c7a --- /dev/null +++ b/src/v1_30/api/core/v1/host_alias.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.core.v1.HostAlias + +/// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HostAlias { + /// Hostnames for the above IP address. + pub hostnames: Option>, + + /// IP address of the host file entry. + pub ip: Option, +} + +impl crate::DeepMerge for HostAlias { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.hostnames, other.hostnames); + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HostAlias { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hostnames, + Key_ip, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hostnames" => Field::Key_hostnames, + "ip" => Field::Key_ip, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HostAlias; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HostAlias") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hostnames: Option> = None; + let mut value_ip: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hostnames => value_hostnames = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HostAlias { + hostnames: value_hostnames, + ip: value_ip, + }) + } + } + + deserializer.deserialize_struct( + "HostAlias", + &[ + "hostnames", + "ip", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HostAlias { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HostAlias", + self.hostnames.as_ref().map_or(0, |_| 1) + + self.ip.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hostnames { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostnames", value)?; + } + if let Some(value) = &self.ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HostAlias { + fn schema_name() -> String { + "io.k8s.api.core.v1.HostAlias".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hostnames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Hostnames for the above IP address.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP address of the host file entry.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/host_ip.rs b/src/v1_30/api/core/v1/host_ip.rs new file mode 100644 index 000000000..037cae73d --- /dev/null +++ b/src/v1_30/api/core/v1/host_ip.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.HostIP + +/// HostIP represents a single IP address allocated to the host. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HostIP { + /// IP is the IP address assigned to the host + pub ip: Option, +} + +impl crate::DeepMerge for HostIP { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HostIP { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ip, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ip" => Field::Key_ip, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HostIP; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HostIP") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ip: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HostIP { + ip: value_ip, + }) + } + } + + deserializer.deserialize_struct( + "HostIP", + &[ + "ip", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HostIP { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HostIP", + self.ip.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HostIP { + fn schema_name() -> String { + "io.k8s.api.core.v1.HostIP".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HostIP represents a single IP address allocated to the host.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP is the IP address assigned to the host".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/host_path_volume_source.rs b/src/v1_30/api/core/v1/host_path_volume_source.rs new file mode 100644 index 000000000..7016c0f02 --- /dev/null +++ b/src/v1_30/api/core/v1/host_path_volume_source.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.HostPathVolumeSource + +/// Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HostPathVolumeSource { + /// path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + pub path: String, + + /// type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + pub type_: Option, +} + +impl crate::DeepMerge for HostPathVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HostPathVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_path, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "path" => Field::Key_path, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HostPathVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HostPathVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_path: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HostPathVolumeSource { + path: value_path.unwrap_or_default(), + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "HostPathVolumeSource", + &[ + "path", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HostPathVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HostPathVolumeSource", + 1 + + self.type_.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HostPathVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.HostPathVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type for HostPath Volume Defaults to \"\" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/http_get_action.rs b/src/v1_30/api/core/v1/http_get_action.rs new file mode 100644 index 000000000..10257ae1a --- /dev/null +++ b/src/v1_30/api/core/v1/http_get_action.rs @@ -0,0 +1,232 @@ +// Generated from definition io.k8s.api.core.v1.HTTPGetAction + +/// HTTPGetAction describes an action based on HTTP Get requests. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HTTPGetAction { + /// Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. + pub host: Option, + + /// Custom headers to set in the request. HTTP allows repeated headers. + pub http_headers: Option>, + + /// Path to access on the HTTP server. + pub path: Option, + + /// Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + pub port: crate::apimachinery::pkg::util::intstr::IntOrString, + + /// Scheme to use for connecting to the host. Defaults to HTTP. + pub scheme: Option, +} + +impl crate::DeepMerge for HTTPGetAction { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.host, other.host); + crate::merge_strategies::list::atomic(&mut self.http_headers, other.http_headers); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.scheme, other.scheme); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HTTPGetAction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_host, + Key_http_headers, + Key_path, + Key_port, + Key_scheme, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "host" => Field::Key_host, + "httpHeaders" => Field::Key_http_headers, + "path" => Field::Key_path, + "port" => Field::Key_port, + "scheme" => Field::Key_scheme, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HTTPGetAction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HTTPGetAction") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_host: Option = None; + let mut value_http_headers: Option> = None; + let mut value_path: Option = None; + let mut value_port: Option = None; + let mut value_scheme: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_host => value_host = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_http_headers => value_http_headers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scheme => value_scheme = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HTTPGetAction { + host: value_host, + http_headers: value_http_headers, + path: value_path, + port: value_port.unwrap_or_default(), + scheme: value_scheme, + }) + } + } + + deserializer.deserialize_struct( + "HTTPGetAction", + &[ + "host", + "httpHeaders", + "path", + "port", + "scheme", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HTTPGetAction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HTTPGetAction", + 1 + + self.host.as_ref().map_or(0, |_| 1) + + self.http_headers.as_ref().map_or(0, |_| 1) + + self.path.as_ref().map_or(0, |_| 1) + + self.scheme.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.host { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "host", value)?; + } + if let Some(value) = &self.http_headers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "httpHeaders", value)?; + } + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + if let Some(value) = &self.scheme { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scheme", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HTTPGetAction { + fn schema_name() -> String { + "io.k8s.api.core.v1.HTTPGetAction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPGetAction describes an action based on HTTP Get requests.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "host".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "httpHeaders".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Custom headers to set in the request. HTTP allows repeated headers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Path to access on the HTTP server.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scheme".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Scheme to use for connecting to the host. Defaults to HTTP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/http_header.rs b/src/v1_30/api/core/v1/http_header.rs new file mode 100644 index 000000000..6599c6e0d --- /dev/null +++ b/src/v1_30/api/core/v1/http_header.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.HTTPHeader + +/// HTTPHeader describes a custom header to be used in HTTP probes +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HTTPHeader { + /// The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header. + pub name: String, + + /// The header field value + pub value: String, +} + +impl crate::DeepMerge for HTTPHeader { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HTTPHeader { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HTTPHeader; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HTTPHeader") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HTTPHeader { + name: value_name.unwrap_or_default(), + value: value_value.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HTTPHeader", + &[ + "name", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HTTPHeader { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HTTPHeader", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", &self.value)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HTTPHeader { + fn schema_name() -> String { + "io.k8s.api.core.v1.HTTPHeader".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPHeader describes a custom header to be used in HTTP probes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The header field name. This will be canonicalized upon output, so case-variant names will be understood as the same header.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The header field value".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "value".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/iscsi_persistent_volume_source.rs b/src/v1_30/api/core/v1/iscsi_persistent_volume_source.rs new file mode 100644 index 000000000..462487bb8 --- /dev/null +++ b/src/v1_30/api/core/v1/iscsi_persistent_volume_source.rs @@ -0,0 +1,384 @@ +// Generated from definition io.k8s.api.core.v1.ISCSIPersistentVolumeSource + +/// ISCSIPersistentVolumeSource represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ISCSIPersistentVolumeSource { + /// chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication + pub chap_auth_discovery: Option, + + /// chapAuthSession defines whether support iSCSI Session CHAP authentication + pub chap_auth_session: Option, + + /// fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + pub fs_type: Option, + + /// initiatorName is the custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface \:\ will be created for the connection. + pub initiator_name: Option, + + /// iqn is Target iSCSI Qualified Name. + pub iqn: String, + + /// iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp). + pub iscsi_interface: Option, + + /// lun is iSCSI Target Lun number. + pub lun: i32, + + /// portals is the iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + pub portals: Option>, + + /// readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. + pub read_only: Option, + + /// secretRef is the CHAP Secret for iSCSI target and initiator authentication + pub secret_ref: Option, + + /// targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + pub target_portal: String, +} + +impl crate::DeepMerge for ISCSIPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.chap_auth_discovery, other.chap_auth_discovery); + crate::DeepMerge::merge_from(&mut self.chap_auth_session, other.chap_auth_session); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.initiator_name, other.initiator_name); + crate::DeepMerge::merge_from(&mut self.iqn, other.iqn); + crate::DeepMerge::merge_from(&mut self.iscsi_interface, other.iscsi_interface); + crate::DeepMerge::merge_from(&mut self.lun, other.lun); + crate::merge_strategies::list::atomic(&mut self.portals, other.portals); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.target_portal, other.target_portal); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ISCSIPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_chap_auth_discovery, + Key_chap_auth_session, + Key_fs_type, + Key_initiator_name, + Key_iqn, + Key_iscsi_interface, + Key_lun, + Key_portals, + Key_read_only, + Key_secret_ref, + Key_target_portal, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "chapAuthDiscovery" => Field::Key_chap_auth_discovery, + "chapAuthSession" => Field::Key_chap_auth_session, + "fsType" => Field::Key_fs_type, + "initiatorName" => Field::Key_initiator_name, + "iqn" => Field::Key_iqn, + "iscsiInterface" => Field::Key_iscsi_interface, + "lun" => Field::Key_lun, + "portals" => Field::Key_portals, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "targetPortal" => Field::Key_target_portal, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ISCSIPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ISCSIPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_chap_auth_discovery: Option = None; + let mut value_chap_auth_session: Option = None; + let mut value_fs_type: Option = None; + let mut value_initiator_name: Option = None; + let mut value_iqn: Option = None; + let mut value_iscsi_interface: Option = None; + let mut value_lun: Option = None; + let mut value_portals: Option> = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_target_portal: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_chap_auth_discovery => value_chap_auth_discovery = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_chap_auth_session => value_chap_auth_session = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_initiator_name => value_initiator_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iqn => value_iqn = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iscsi_interface => value_iscsi_interface = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lun => value_lun = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_portals => value_portals = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_portal => value_target_portal = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ISCSIPersistentVolumeSource { + chap_auth_discovery: value_chap_auth_discovery, + chap_auth_session: value_chap_auth_session, + fs_type: value_fs_type, + initiator_name: value_initiator_name, + iqn: value_iqn.unwrap_or_default(), + iscsi_interface: value_iscsi_interface, + lun: value_lun.unwrap_or_default(), + portals: value_portals, + read_only: value_read_only, + secret_ref: value_secret_ref, + target_portal: value_target_portal.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ISCSIPersistentVolumeSource", + &[ + "chapAuthDiscovery", + "chapAuthSession", + "fsType", + "initiatorName", + "iqn", + "iscsiInterface", + "lun", + "portals", + "readOnly", + "secretRef", + "targetPortal", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ISCSIPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ISCSIPersistentVolumeSource", + 3 + + self.chap_auth_discovery.as_ref().map_or(0, |_| 1) + + self.chap_auth_session.as_ref().map_or(0, |_| 1) + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.initiator_name.as_ref().map_or(0, |_| 1) + + self.iscsi_interface.as_ref().map_or(0, |_| 1) + + self.portals.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.chap_auth_discovery { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "chapAuthDiscovery", value)?; + } + if let Some(value) = &self.chap_auth_session { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "chapAuthSession", value)?; + } + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.initiator_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "initiatorName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iqn", &self.iqn)?; + if let Some(value) = &self.iscsi_interface { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsiInterface", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lun", &self.lun)?; + if let Some(value) = &self.portals { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portals", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetPortal", &self.target_portal)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ISCSIPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ISCSIPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ISCSIPersistentVolumeSource represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "chapAuthDiscovery".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "chapAuthSession".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("chapAuthSession defines whether support iSCSI Session CHAP authentication".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "initiatorName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("initiatorName is the custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "iqn".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iqn is Target iSCSI Qualified Name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "iscsiInterface".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lun".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lun is iSCSI Target Lun number.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "portals".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("portals is the iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is the CHAP Secret for iSCSI target and initiator authentication".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "targetPortal".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "iqn".to_owned(), + "lun".to_owned(), + "targetPortal".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/iscsi_volume_source.rs b/src/v1_30/api/core/v1/iscsi_volume_source.rs new file mode 100644 index 000000000..d9d95c147 --- /dev/null +++ b/src/v1_30/api/core/v1/iscsi_volume_source.rs @@ -0,0 +1,384 @@ +// Generated from definition io.k8s.api.core.v1.ISCSIVolumeSource + +/// Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ISCSIVolumeSource { + /// chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication + pub chap_auth_discovery: Option, + + /// chapAuthSession defines whether support iSCSI Session CHAP authentication + pub chap_auth_session: Option, + + /// fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + pub fs_type: Option, + + /// initiatorName is the custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface \:\ will be created for the connection. + pub initiator_name: Option, + + /// iqn is the target iSCSI Qualified Name. + pub iqn: String, + + /// iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp). + pub iscsi_interface: Option, + + /// lun represents iSCSI Target Lun number. + pub lun: i32, + + /// portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + pub portals: Option>, + + /// readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. + pub read_only: Option, + + /// secretRef is the CHAP Secret for iSCSI target and initiator authentication + pub secret_ref: Option, + + /// targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + pub target_portal: String, +} + +impl crate::DeepMerge for ISCSIVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.chap_auth_discovery, other.chap_auth_discovery); + crate::DeepMerge::merge_from(&mut self.chap_auth_session, other.chap_auth_session); + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.initiator_name, other.initiator_name); + crate::DeepMerge::merge_from(&mut self.iqn, other.iqn); + crate::DeepMerge::merge_from(&mut self.iscsi_interface, other.iscsi_interface); + crate::DeepMerge::merge_from(&mut self.lun, other.lun); + crate::merge_strategies::list::atomic(&mut self.portals, other.portals); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.target_portal, other.target_portal); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ISCSIVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_chap_auth_discovery, + Key_chap_auth_session, + Key_fs_type, + Key_initiator_name, + Key_iqn, + Key_iscsi_interface, + Key_lun, + Key_portals, + Key_read_only, + Key_secret_ref, + Key_target_portal, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "chapAuthDiscovery" => Field::Key_chap_auth_discovery, + "chapAuthSession" => Field::Key_chap_auth_session, + "fsType" => Field::Key_fs_type, + "initiatorName" => Field::Key_initiator_name, + "iqn" => Field::Key_iqn, + "iscsiInterface" => Field::Key_iscsi_interface, + "lun" => Field::Key_lun, + "portals" => Field::Key_portals, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "targetPortal" => Field::Key_target_portal, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ISCSIVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ISCSIVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_chap_auth_discovery: Option = None; + let mut value_chap_auth_session: Option = None; + let mut value_fs_type: Option = None; + let mut value_initiator_name: Option = None; + let mut value_iqn: Option = None; + let mut value_iscsi_interface: Option = None; + let mut value_lun: Option = None; + let mut value_portals: Option> = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_target_portal: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_chap_auth_discovery => value_chap_auth_discovery = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_chap_auth_session => value_chap_auth_session = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_initiator_name => value_initiator_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iqn => value_iqn = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iscsi_interface => value_iscsi_interface = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lun => value_lun = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_portals => value_portals = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_portal => value_target_portal = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ISCSIVolumeSource { + chap_auth_discovery: value_chap_auth_discovery, + chap_auth_session: value_chap_auth_session, + fs_type: value_fs_type, + initiator_name: value_initiator_name, + iqn: value_iqn.unwrap_or_default(), + iscsi_interface: value_iscsi_interface, + lun: value_lun.unwrap_or_default(), + portals: value_portals, + read_only: value_read_only, + secret_ref: value_secret_ref, + target_portal: value_target_portal.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ISCSIVolumeSource", + &[ + "chapAuthDiscovery", + "chapAuthSession", + "fsType", + "initiatorName", + "iqn", + "iscsiInterface", + "lun", + "portals", + "readOnly", + "secretRef", + "targetPortal", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ISCSIVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ISCSIVolumeSource", + 3 + + self.chap_auth_discovery.as_ref().map_or(0, |_| 1) + + self.chap_auth_session.as_ref().map_or(0, |_| 1) + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.initiator_name.as_ref().map_or(0, |_| 1) + + self.iscsi_interface.as_ref().map_or(0, |_| 1) + + self.portals.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.chap_auth_discovery { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "chapAuthDiscovery", value)?; + } + if let Some(value) = &self.chap_auth_session { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "chapAuthSession", value)?; + } + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.initiator_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "initiatorName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iqn", &self.iqn)?; + if let Some(value) = &self.iscsi_interface { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsiInterface", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lun", &self.lun)?; + if let Some(value) = &self.portals { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portals", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetPortal", &self.target_portal)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ISCSIVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ISCSIVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "chapAuthDiscovery".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "chapAuthSession".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("chapAuthSession defines whether support iSCSI Session CHAP authentication".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "initiatorName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("initiatorName is the custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "iqn".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iqn is the target iSCSI Qualified Name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "iscsiInterface".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lun".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lun represents iSCSI Target Lun number.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "portals".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is the CHAP Secret for iSCSI target and initiator authentication".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "targetPortal".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "iqn".to_owned(), + "lun".to_owned(), + "targetPortal".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/key_to_path.rs b/src/v1_30/api/core/v1/key_to_path.rs new file mode 100644 index 000000000..6ea9c5e28 --- /dev/null +++ b/src/v1_30/api/core/v1/key_to_path.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.core.v1.KeyToPath + +/// Maps a string key to a path within a volume. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct KeyToPath { + /// key is the key to project. + pub key: String, + + /// mode is Optional: mode bits used to set permissions on this file. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub mode: Option, + + /// path is the relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + pub path: String, +} + +impl crate::DeepMerge for KeyToPath { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.mode, other.mode); + crate::DeepMerge::merge_from(&mut self.path, other.path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for KeyToPath { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_mode, + Key_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "mode" => Field::Key_mode, + "path" => Field::Key_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = KeyToPath; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("KeyToPath") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_mode: Option = None; + let mut value_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mode => value_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(KeyToPath { + key: value_key.unwrap_or_default(), + mode: value_mode, + path: value_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "KeyToPath", + &[ + "key", + "mode", + "path", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for KeyToPath { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "KeyToPath", + 2 + + self.mode.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + if let Some(value) = &self.mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mode", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for KeyToPath { + fn schema_name() -> String { + "io.k8s.api.core.v1.KeyToPath".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Maps a string key to a path within a volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("key is the key to project.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "mode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("mode is Optional: mode bits used to set permissions on this file. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is the relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/lifecycle.rs b/src/v1_30/api/core/v1/lifecycle.rs new file mode 100644 index 000000000..b47b1488c --- /dev/null +++ b/src/v1_30/api/core/v1/lifecycle.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.Lifecycle + +/// Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Lifecycle { + /// PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + pub post_start: Option, + + /// PreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + pub pre_stop: Option, +} + +impl crate::DeepMerge for Lifecycle { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.post_start, other.post_start); + crate::DeepMerge::merge_from(&mut self.pre_stop, other.pre_stop); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Lifecycle { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_post_start, + Key_pre_stop, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "postStart" => Field::Key_post_start, + "preStop" => Field::Key_pre_stop, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Lifecycle; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Lifecycle") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_post_start: Option = None; + let mut value_pre_stop: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_post_start => value_post_start = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pre_stop => value_pre_stop = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Lifecycle { + post_start: value_post_start, + pre_stop: value_pre_stop, + }) + } + } + + deserializer.deserialize_struct( + "Lifecycle", + &[ + "postStart", + "preStop", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Lifecycle { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Lifecycle", + self.post_start.as_ref().map_or(0, |_| 1) + + self.pre_stop.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.post_start { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "postStart", value)?; + } + if let Some(value) = &self.pre_stop { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preStop", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Lifecycle { + fn schema_name() -> String { + "io.k8s.api.core.v1.Lifecycle".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "postStart".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "preStop".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/lifecycle_handler.rs b/src/v1_30/api/core/v1/lifecycle_handler.rs new file mode 100644 index 000000000..12169b77e --- /dev/null +++ b/src/v1_30/api/core/v1/lifecycle_handler.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.LifecycleHandler + +/// LifecycleHandler defines a specific action that should be taken in a lifecycle hook. One and only one of the fields, except TCPSocket must be specified. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LifecycleHandler { + /// Exec specifies the action to take. + pub exec: Option, + + /// HTTPGet specifies the http request to perform. + pub http_get: Option, + + /// Sleep represents the duration that the container should sleep before being terminated. + pub sleep: Option, + + /// Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified. + pub tcp_socket: Option, +} + +impl crate::DeepMerge for LifecycleHandler { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.exec, other.exec); + crate::DeepMerge::merge_from(&mut self.http_get, other.http_get); + crate::DeepMerge::merge_from(&mut self.sleep, other.sleep); + crate::DeepMerge::merge_from(&mut self.tcp_socket, other.tcp_socket); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LifecycleHandler { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exec, + Key_http_get, + Key_sleep, + Key_tcp_socket, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "exec" => Field::Key_exec, + "httpGet" => Field::Key_http_get, + "sleep" => Field::Key_sleep, + "tcpSocket" => Field::Key_tcp_socket, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LifecycleHandler; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LifecycleHandler") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exec: Option = None; + let mut value_http_get: Option = None; + let mut value_sleep: Option = None; + let mut value_tcp_socket: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exec => value_exec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_http_get => value_http_get = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_sleep => value_sleep = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tcp_socket => value_tcp_socket = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LifecycleHandler { + exec: value_exec, + http_get: value_http_get, + sleep: value_sleep, + tcp_socket: value_tcp_socket, + }) + } + } + + deserializer.deserialize_struct( + "LifecycleHandler", + &[ + "exec", + "httpGet", + "sleep", + "tcpSocket", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LifecycleHandler { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LifecycleHandler", + self.exec.as_ref().map_or(0, |_| 1) + + self.http_get.as_ref().map_or(0, |_| 1) + + self.sleep.as_ref().map_or(0, |_| 1) + + self.tcp_socket.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exec", value)?; + } + if let Some(value) = &self.http_get { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "httpGet", value)?; + } + if let Some(value) = &self.sleep { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sleep", value)?; + } + if let Some(value) = &self.tcp_socket { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tcpSocket", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LifecycleHandler { + fn schema_name() -> String { + "io.k8s.api.core.v1.LifecycleHandler".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LifecycleHandler defines a specific action that should be taken in a lifecycle hook. One and only one of the fields, except TCPSocket must be specified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "exec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Exec specifies the action to take.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "httpGet".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPGet specifies the http request to perform.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "sleep".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Sleep represents the duration that the container should sleep before being terminated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "tcpSocket".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/limit_range.rs b/src/v1_30/api/core/v1/limit_range.rs new file mode 100644 index 000000000..f02b39ccd --- /dev/null +++ b/src/v1_30/api/core/v1/limit_range.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.core.v1.LimitRange + +/// LimitRange sets resource usage limits for each kind of resource in a Namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitRange { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the limits enforced. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::Resource for LimitRange { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "LimitRange"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "limitranges"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for LimitRange { + const LIST_KIND: &'static str = "LimitRangeList"; +} + +impl crate::Metadata for LimitRange { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for LimitRange { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitRange { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitRange; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitRange { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitRange { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitRange { + fn schema_name() -> String { + "io.k8s.api.core.v1.LimitRange".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitRange sets resource usage limits for each kind of resource in a Namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the limits enforced. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/limit_range_item.rs b/src/v1_30/api/core/v1/limit_range_item.rs new file mode 100644 index 000000000..d8431aec8 --- /dev/null +++ b/src/v1_30/api/core/v1/limit_range_item.rs @@ -0,0 +1,283 @@ +// Generated from definition io.k8s.api.core.v1.LimitRangeItem + +/// LimitRangeItem defines a min/max usage limit for any resource that matches on kind. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitRangeItem { + /// Default resource requirement limit value by resource name if resource limit is omitted. + pub default: Option>, + + /// DefaultRequest is the default resource requirement request value by resource name if resource request is omitted. + pub default_request: Option>, + + /// Max usage constraints on this kind by resource name. + pub max: Option>, + + /// MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource. + pub max_limit_request_ratio: Option>, + + /// Min usage constraints on this kind by resource name. + pub min: Option>, + + /// Type of resource that this limit applies to. + pub type_: String, +} + +impl crate::DeepMerge for LimitRangeItem { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.default, other.default, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.default_request, other.default_request, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.max, other.max, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.max_limit_request_ratio, other.max_limit_request_ratio, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.min, other.min, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitRangeItem { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default, + Key_default_request, + Key_max, + Key_max_limit_request_ratio, + Key_min, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "default" => Field::Key_default, + "defaultRequest" => Field::Key_default_request, + "max" => Field::Key_max, + "maxLimitRequestRatio" => Field::Key_max_limit_request_ratio, + "min" => Field::Key_min, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitRangeItem; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitRangeItem") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default: Option> = None; + let mut value_default_request: Option> = None; + let mut value_max: Option> = None; + let mut value_max_limit_request_ratio: Option> = None; + let mut value_min: Option> = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default => value_default = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_default_request => value_default_request = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max => value_max = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_limit_request_ratio => value_max_limit_request_ratio = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min => value_min = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitRangeItem { + default: value_default, + default_request: value_default_request, + max: value_max, + max_limit_request_ratio: value_max_limit_request_ratio, + min: value_min, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "LimitRangeItem", + &[ + "default", + "defaultRequest", + "max", + "maxLimitRequestRatio", + "min", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitRangeItem { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitRangeItem", + 1 + + self.default.as_ref().map_or(0, |_| 1) + + self.default_request.as_ref().map_or(0, |_| 1) + + self.max.as_ref().map_or(0, |_| 1) + + self.max_limit_request_ratio.as_ref().map_or(0, |_| 1) + + self.min.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "default", value)?; + } + if let Some(value) = &self.default_request { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultRequest", value)?; + } + if let Some(value) = &self.max { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "max", value)?; + } + if let Some(value) = &self.max_limit_request_ratio { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxLimitRequestRatio", value)?; + } + if let Some(value) = &self.min { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "min", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitRangeItem { + fn schema_name() -> String { + "io.k8s.api.core.v1.LimitRangeItem".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitRangeItem defines a min/max usage limit for any resource that matches on kind.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "default".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Default resource requirement limit value by resource name if resource limit is omitted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "defaultRequest".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DefaultRequest is the default resource requirement request value by resource name if resource request is omitted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "max".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Max usage constraints on this kind by resource name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "maxLimitRequestRatio".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "min".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Min usage constraints on this kind by resource name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of resource that this limit applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/limit_range_spec.rs b/src/v1_30/api/core/v1/limit_range_spec.rs new file mode 100644 index 000000000..14cacbd61 --- /dev/null +++ b/src/v1_30/api/core/v1/limit_range_spec.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.core.v1.LimitRangeSpec + +/// LimitRangeSpec defines a min/max usage limit for resources that match on kind. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitRangeSpec { + /// Limits is the list of LimitRangeItem objects that are enforced. + pub limits: Vec, +} + +impl crate::DeepMerge for LimitRangeSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.limits, other.limits); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitRangeSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_limits, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "limits" => Field::Key_limits, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitRangeSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitRangeSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_limits: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_limits => value_limits = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitRangeSpec { + limits: value_limits.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "LimitRangeSpec", + &[ + "limits", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitRangeSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitRangeSpec", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limits", &self.limits)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitRangeSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.LimitRangeSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitRangeSpec defines a min/max usage limit for resources that match on kind.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "limits".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Limits is the list of LimitRangeItem objects that are enforced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "limits".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/load_balancer_ingress.rs b/src/v1_30/api/core/v1/load_balancer_ingress.rs new file mode 100644 index 000000000..0f53da4bf --- /dev/null +++ b/src/v1_30/api/core/v1/load_balancer_ingress.rs @@ -0,0 +1,206 @@ +// Generated from definition io.k8s.api.core.v1.LoadBalancerIngress + +/// LoadBalancerIngress represents the status of a load-balancer ingress point: traffic intended for the service should be sent to an ingress point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LoadBalancerIngress { + /// Hostname is set for load-balancer ingress points that are DNS based (typically AWS load-balancers) + pub hostname: Option, + + /// IP is set for load-balancer ingress points that are IP based (typically GCE or OpenStack load-balancers) + pub ip: Option, + + /// IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. Setting this to "VIP" indicates that traffic is delivered to the node with the destination set to the load-balancer's IP and port. Setting this to "Proxy" indicates that traffic is delivered to the node or pod with the destination set to the node's IP and node port or the pod's IP and port. Service implementations may use this information to adjust traffic routing. + pub ip_mode: Option, + + /// Ports is a list of records of service ports If used, every port defined in the service should have an entry in it + pub ports: Option>, +} + +impl crate::DeepMerge for LoadBalancerIngress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.hostname, other.hostname); + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + crate::DeepMerge::merge_from(&mut self.ip_mode, other.ip_mode); + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LoadBalancerIngress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hostname, + Key_ip, + Key_ip_mode, + Key_ports, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hostname" => Field::Key_hostname, + "ip" => Field::Key_ip, + "ipMode" => Field::Key_ip_mode, + "ports" => Field::Key_ports, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LoadBalancerIngress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LoadBalancerIngress") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hostname: Option = None; + let mut value_ip: Option = None; + let mut value_ip_mode: Option = None; + let mut value_ports: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hostname => value_hostname = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip_mode => value_ip_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LoadBalancerIngress { + hostname: value_hostname, + ip: value_ip, + ip_mode: value_ip_mode, + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + "LoadBalancerIngress", + &[ + "hostname", + "ip", + "ipMode", + "ports", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LoadBalancerIngress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LoadBalancerIngress", + self.hostname.as_ref().map_or(0, |_| 1) + + self.ip.as_ref().map_or(0, |_| 1) + + self.ip_mode.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hostname { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostname", value)?; + } + if let Some(value) = &self.ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", value)?; + } + if let Some(value) = &self.ip_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipMode", value)?; + } + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LoadBalancerIngress { + fn schema_name() -> String { + "io.k8s.api.core.v1.LoadBalancerIngress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LoadBalancerIngress represents the status of a load-balancer ingress point: traffic intended for the service should be sent to an ingress point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hostname".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Hostname is set for load-balancer ingress points that are DNS based (typically AWS load-balancers)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP is set for load-balancer ingress points that are IP based (typically GCE or OpenStack load-balancers)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ipMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified. Setting this to \"VIP\" indicates that traffic is delivered to the node with the destination set to the load-balancer's IP and port. Setting this to \"Proxy\" indicates that traffic is delivered to the node or pod with the destination set to the node's IP and node port or the pod's IP and port. Service implementations may use this information to adjust traffic routing.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ports is a list of records of service ports If used, every port defined in the service should have an entry in it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/load_balancer_status.rs b/src/v1_30/api/core/v1/load_balancer_status.rs new file mode 100644 index 000000000..67379f9e4 --- /dev/null +++ b/src/v1_30/api/core/v1/load_balancer_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.core.v1.LoadBalancerStatus + +/// LoadBalancerStatus represents the status of a load-balancer. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LoadBalancerStatus { + /// Ingress is a list containing ingress points for the load-balancer. Traffic intended for the service should be sent to these ingress points. + pub ingress: Option>, +} + +impl crate::DeepMerge for LoadBalancerStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.ingress, other.ingress); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LoadBalancerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ingress, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ingress" => Field::Key_ingress, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LoadBalancerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LoadBalancerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ingress: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ingress => value_ingress = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LoadBalancerStatus { + ingress: value_ingress, + }) + } + } + + deserializer.deserialize_struct( + "LoadBalancerStatus", + &[ + "ingress", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LoadBalancerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LoadBalancerStatus", + self.ingress.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ingress { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ingress", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LoadBalancerStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.LoadBalancerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LoadBalancerStatus represents the status of a load-balancer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ingress".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ingress is a list containing ingress points for the load-balancer. Traffic intended for the service should be sent to these ingress points.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/local_object_reference.rs b/src/v1_30/api/core/v1/local_object_reference.rs new file mode 100644 index 000000000..3ece11a42 --- /dev/null +++ b/src/v1_30/api/core/v1/local_object_reference.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.LocalObjectReference + +/// LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LocalObjectReference { + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, +} + +impl crate::DeepMerge for LocalObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LocalObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LocalObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LocalObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LocalObjectReference { + name: value_name, + }) + } + } + + deserializer.deserialize_struct( + "LocalObjectReference", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LocalObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LocalObjectReference", + self.name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LocalObjectReference { + fn schema_name() -> String { + "io.k8s.api.core.v1.LocalObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/local_volume_source.rs b/src/v1_30/api/core/v1/local_volume_source.rs new file mode 100644 index 000000000..0f0a5cb8d --- /dev/null +++ b/src/v1_30/api/core/v1/local_volume_source.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.LocalVolumeSource + +/// Local represents directly-attached storage with node affinity (Beta feature) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LocalVolumeSource { + /// fsType is the filesystem type to mount. It applies only when the Path is a block device. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default value is to auto-select a filesystem if unspecified. + pub fs_type: Option, + + /// path of the full path to the volume on the node. It can be either a directory or block device (disk, partition, ...). + pub path: String, +} + +impl crate::DeepMerge for LocalVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.path, other.path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LocalVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "path" => Field::Key_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LocalVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LocalVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LocalVolumeSource { + fs_type: value_fs_type, + path: value_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "LocalVolumeSource", + &[ + "fsType", + "path", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LocalVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LocalVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LocalVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.LocalVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Local represents directly-attached storage with node affinity (Beta feature)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. It applies only when the Path is a block device. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default value is to auto-select a filesystem if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path of the full path to the volume on the node. It can be either a directory or block device (disk, partition, ...).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/mod.rs b/src/v1_30/api/core/v1/mod.rs new file mode 100644 index 000000000..895d4aa6c --- /dev/null +++ b/src/v1_30/api/core/v1/mod.rs @@ -0,0 +1,570 @@ + +mod aws_elastic_block_store_volume_source; +pub use self::aws_elastic_block_store_volume_source::AWSElasticBlockStoreVolumeSource; + +mod affinity; +pub use self::affinity::Affinity; + +mod app_armor_profile; +pub use self::app_armor_profile::AppArmorProfile; + +mod attached_volume; +pub use self::attached_volume::AttachedVolume; + +mod azure_disk_volume_source; +pub use self::azure_disk_volume_source::AzureDiskVolumeSource; + +mod azure_file_persistent_volume_source; +pub use self::azure_file_persistent_volume_source::AzureFilePersistentVolumeSource; + +mod azure_file_volume_source; +pub use self::azure_file_volume_source::AzureFileVolumeSource; + +mod binding; +pub use self::binding::Binding; + +mod csi_persistent_volume_source; +pub use self::csi_persistent_volume_source::CSIPersistentVolumeSource; + +mod csi_volume_source; +pub use self::csi_volume_source::CSIVolumeSource; + +mod capabilities; +pub use self::capabilities::Capabilities; + +mod ceph_fs_persistent_volume_source; +pub use self::ceph_fs_persistent_volume_source::CephFSPersistentVolumeSource; + +mod ceph_fs_volume_source; +pub use self::ceph_fs_volume_source::CephFSVolumeSource; + +mod cinder_persistent_volume_source; +pub use self::cinder_persistent_volume_source::CinderPersistentVolumeSource; + +mod cinder_volume_source; +pub use self::cinder_volume_source::CinderVolumeSource; + +mod claim_source; +pub use self::claim_source::ClaimSource; + +mod client_ip_config; +pub use self::client_ip_config::ClientIPConfig; + +mod cluster_trust_bundle_projection; +pub use self::cluster_trust_bundle_projection::ClusterTrustBundleProjection; + +mod component_condition; +pub use self::component_condition::ComponentCondition; + +mod component_status; +pub use self::component_status::ComponentStatus; + +mod config_map; +pub use self::config_map::ConfigMap; + +mod config_map_env_source; +pub use self::config_map_env_source::ConfigMapEnvSource; + +mod config_map_key_selector; +pub use self::config_map_key_selector::ConfigMapKeySelector; + +mod config_map_node_config_source; +pub use self::config_map_node_config_source::ConfigMapNodeConfigSource; + +mod config_map_projection; +pub use self::config_map_projection::ConfigMapProjection; + +mod config_map_volume_source; +pub use self::config_map_volume_source::ConfigMapVolumeSource; + +mod container; +pub use self::container::Container; + +mod container_image; +pub use self::container_image::ContainerImage; + +mod container_port; +pub use self::container_port::ContainerPort; + +mod container_resize_policy; +pub use self::container_resize_policy::ContainerResizePolicy; + +mod container_state; +pub use self::container_state::ContainerState; + +mod container_state_running; +pub use self::container_state_running::ContainerStateRunning; + +mod container_state_terminated; +pub use self::container_state_terminated::ContainerStateTerminated; + +mod container_state_waiting; +pub use self::container_state_waiting::ContainerStateWaiting; + +mod container_status; +pub use self::container_status::ContainerStatus; + +mod daemon_endpoint; +pub use self::daemon_endpoint::DaemonEndpoint; + +mod downward_api_projection; +pub use self::downward_api_projection::DownwardAPIProjection; + +mod downward_api_volume_file; +pub use self::downward_api_volume_file::DownwardAPIVolumeFile; + +mod downward_api_volume_source; +pub use self::downward_api_volume_source::DownwardAPIVolumeSource; + +mod empty_dir_volume_source; +pub use self::empty_dir_volume_source::EmptyDirVolumeSource; + +mod endpoint_address; +pub use self::endpoint_address::EndpointAddress; + +mod endpoint_port; +pub use self::endpoint_port::EndpointPort; + +mod endpoint_subset; +pub use self::endpoint_subset::EndpointSubset; + +mod endpoints; +pub use self::endpoints::Endpoints; + +mod env_from_source; +pub use self::env_from_source::EnvFromSource; + +mod env_var; +pub use self::env_var::EnvVar; + +mod env_var_source; +pub use self::env_var_source::EnvVarSource; + +mod ephemeral_container; +pub use self::ephemeral_container::EphemeralContainer; + +mod ephemeral_volume_source; +pub use self::ephemeral_volume_source::EphemeralVolumeSource; + +mod event; +pub use self::event::Event; + +mod event_series; +pub use self::event_series::EventSeries; + +mod event_source; +pub use self::event_source::EventSource; + +mod exec_action; +pub use self::exec_action::ExecAction; + +mod fc_volume_source; +pub use self::fc_volume_source::FCVolumeSource; + +mod flex_persistent_volume_source; +pub use self::flex_persistent_volume_source::FlexPersistentVolumeSource; + +mod flex_volume_source; +pub use self::flex_volume_source::FlexVolumeSource; + +mod flocker_volume_source; +pub use self::flocker_volume_source::FlockerVolumeSource; + +mod gce_persistent_disk_volume_source; +pub use self::gce_persistent_disk_volume_source::GCEPersistentDiskVolumeSource; + +mod grpc_action; +pub use self::grpc_action::GRPCAction; + +mod git_repo_volume_source; +pub use self::git_repo_volume_source::GitRepoVolumeSource; + +mod glusterfs_persistent_volume_source; +pub use self::glusterfs_persistent_volume_source::GlusterfsPersistentVolumeSource; + +mod glusterfs_volume_source; +pub use self::glusterfs_volume_source::GlusterfsVolumeSource; + +mod http_get_action; +pub use self::http_get_action::HTTPGetAction; + +mod http_header; +pub use self::http_header::HTTPHeader; + +mod host_alias; +pub use self::host_alias::HostAlias; + +mod host_ip; +pub use self::host_ip::HostIP; + +mod host_path_volume_source; +pub use self::host_path_volume_source::HostPathVolumeSource; + +mod iscsi_persistent_volume_source; +pub use self::iscsi_persistent_volume_source::ISCSIPersistentVolumeSource; + +mod iscsi_volume_source; +pub use self::iscsi_volume_source::ISCSIVolumeSource; + +mod key_to_path; +pub use self::key_to_path::KeyToPath; + +mod lifecycle; +pub use self::lifecycle::Lifecycle; + +mod lifecycle_handler; +pub use self::lifecycle_handler::LifecycleHandler; + +mod limit_range; +pub use self::limit_range::LimitRange; + +mod limit_range_item; +pub use self::limit_range_item::LimitRangeItem; + +mod limit_range_spec; +pub use self::limit_range_spec::LimitRangeSpec; + +mod load_balancer_ingress; +pub use self::load_balancer_ingress::LoadBalancerIngress; + +mod load_balancer_status; +pub use self::load_balancer_status::LoadBalancerStatus; + +mod local_object_reference; +pub use self::local_object_reference::LocalObjectReference; + +mod local_volume_source; +pub use self::local_volume_source::LocalVolumeSource; + +mod modify_volume_status; +pub use self::modify_volume_status::ModifyVolumeStatus; + +mod nfs_volume_source; +pub use self::nfs_volume_source::NFSVolumeSource; + +mod namespace; +pub use self::namespace::Namespace; + +mod namespace_condition; +pub use self::namespace_condition::NamespaceCondition; + +mod namespace_spec; +pub use self::namespace_spec::NamespaceSpec; + +mod namespace_status; +pub use self::namespace_status::NamespaceStatus; + +mod node; +pub use self::node::Node; + +mod node_address; +pub use self::node_address::NodeAddress; + +mod node_affinity; +pub use self::node_affinity::NodeAffinity; + +mod node_condition; +pub use self::node_condition::NodeCondition; + +mod node_config_source; +pub use self::node_config_source::NodeConfigSource; + +mod node_config_status; +pub use self::node_config_status::NodeConfigStatus; + +mod node_daemon_endpoints; +pub use self::node_daemon_endpoints::NodeDaemonEndpoints; + +mod node_runtime_handler; +pub use self::node_runtime_handler::NodeRuntimeHandler; + +mod node_runtime_handler_features; +pub use self::node_runtime_handler_features::NodeRuntimeHandlerFeatures; + +mod node_selector; +pub use self::node_selector::NodeSelector; + +mod node_selector_requirement; +pub use self::node_selector_requirement::NodeSelectorRequirement; + +mod node_selector_term; +pub use self::node_selector_term::NodeSelectorTerm; + +mod node_spec; +pub use self::node_spec::NodeSpec; + +mod node_status; +pub use self::node_status::NodeStatus; + +mod node_system_info; +pub use self::node_system_info::NodeSystemInfo; + +mod object_field_selector; +pub use self::object_field_selector::ObjectFieldSelector; + +mod object_reference; +pub use self::object_reference::ObjectReference; + +mod persistent_volume; +pub use self::persistent_volume::PersistentVolume; + +mod persistent_volume_claim; +pub use self::persistent_volume_claim::PersistentVolumeClaim; + +mod persistent_volume_claim_condition; +pub use self::persistent_volume_claim_condition::PersistentVolumeClaimCondition; + +mod persistent_volume_claim_spec; +pub use self::persistent_volume_claim_spec::PersistentVolumeClaimSpec; + +mod persistent_volume_claim_status; +pub use self::persistent_volume_claim_status::PersistentVolumeClaimStatus; + +mod persistent_volume_claim_template; +pub use self::persistent_volume_claim_template::PersistentVolumeClaimTemplate; + +mod persistent_volume_claim_volume_source; +pub use self::persistent_volume_claim_volume_source::PersistentVolumeClaimVolumeSource; + +mod persistent_volume_spec; +pub use self::persistent_volume_spec::PersistentVolumeSpec; + +mod persistent_volume_status; +pub use self::persistent_volume_status::PersistentVolumeStatus; + +mod photon_persistent_disk_volume_source; +pub use self::photon_persistent_disk_volume_source::PhotonPersistentDiskVolumeSource; + +mod pod; +pub use self::pod::Pod; + +mod pod_affinity; +pub use self::pod_affinity::PodAffinity; + +mod pod_affinity_term; +pub use self::pod_affinity_term::PodAffinityTerm; + +mod pod_anti_affinity; +pub use self::pod_anti_affinity::PodAntiAffinity; + +mod pod_condition; +pub use self::pod_condition::PodCondition; + +mod pod_dns_config; +pub use self::pod_dns_config::PodDNSConfig; + +mod pod_dns_config_option; +pub use self::pod_dns_config_option::PodDNSConfigOption; + +mod pod_ip; +pub use self::pod_ip::PodIP; + +mod pod_os; +pub use self::pod_os::PodOS; + +mod pod_readiness_gate; +pub use self::pod_readiness_gate::PodReadinessGate; + +mod pod_resource_claim; +pub use self::pod_resource_claim::PodResourceClaim; + +mod pod_resource_claim_status; +pub use self::pod_resource_claim_status::PodResourceClaimStatus; + +mod pod_scheduling_gate; +pub use self::pod_scheduling_gate::PodSchedulingGate; + +mod pod_security_context; +pub use self::pod_security_context::PodSecurityContext; + +mod pod_spec; +pub use self::pod_spec::PodSpec; + +mod pod_status; +pub use self::pod_status::PodStatus; + +mod pod_template; +pub use self::pod_template::PodTemplate; + +mod pod_template_spec; +pub use self::pod_template_spec::PodTemplateSpec; + +mod port_status; +pub use self::port_status::PortStatus; + +mod portworx_volume_source; +pub use self::portworx_volume_source::PortworxVolumeSource; + +mod preferred_scheduling_term; +pub use self::preferred_scheduling_term::PreferredSchedulingTerm; + +mod probe; +pub use self::probe::Probe; + +mod projected_volume_source; +pub use self::projected_volume_source::ProjectedVolumeSource; + +mod quobyte_volume_source; +pub use self::quobyte_volume_source::QuobyteVolumeSource; + +mod rbd_persistent_volume_source; +pub use self::rbd_persistent_volume_source::RBDPersistentVolumeSource; + +mod rbd_volume_source; +pub use self::rbd_volume_source::RBDVolumeSource; + +mod replication_controller; +pub use self::replication_controller::ReplicationController; + +mod replication_controller_condition; +pub use self::replication_controller_condition::ReplicationControllerCondition; + +mod replication_controller_spec; +pub use self::replication_controller_spec::ReplicationControllerSpec; + +mod replication_controller_status; +pub use self::replication_controller_status::ReplicationControllerStatus; + +mod resource_claim; +pub use self::resource_claim::ResourceClaim; + +mod resource_field_selector; +pub use self::resource_field_selector::ResourceFieldSelector; + +mod resource_quota; +pub use self::resource_quota::ResourceQuota; + +mod resource_quota_spec; +pub use self::resource_quota_spec::ResourceQuotaSpec; + +mod resource_quota_status; +pub use self::resource_quota_status::ResourceQuotaStatus; + +mod resource_requirements; +pub use self::resource_requirements::ResourceRequirements; + +mod se_linux_options; +pub use self::se_linux_options::SELinuxOptions; + +mod scale_io_persistent_volume_source; +pub use self::scale_io_persistent_volume_source::ScaleIOPersistentVolumeSource; + +mod scale_io_volume_source; +pub use self::scale_io_volume_source::ScaleIOVolumeSource; + +mod scope_selector; +pub use self::scope_selector::ScopeSelector; + +mod scoped_resource_selector_requirement; +pub use self::scoped_resource_selector_requirement::ScopedResourceSelectorRequirement; + +mod seccomp_profile; +pub use self::seccomp_profile::SeccompProfile; + +mod secret; +pub use self::secret::Secret; + +mod secret_env_source; +pub use self::secret_env_source::SecretEnvSource; + +mod secret_key_selector; +pub use self::secret_key_selector::SecretKeySelector; + +mod secret_projection; +pub use self::secret_projection::SecretProjection; + +mod secret_reference; +pub use self::secret_reference::SecretReference; + +mod secret_volume_source; +pub use self::secret_volume_source::SecretVolumeSource; + +mod security_context; +pub use self::security_context::SecurityContext; + +mod service; +pub use self::service::Service; + +mod service_account; +pub use self::service_account::ServiceAccount; + +mod service_account_token_projection; +pub use self::service_account_token_projection::ServiceAccountTokenProjection; + +mod service_port; +pub use self::service_port::ServicePort; + +mod service_spec; +pub use self::service_spec::ServiceSpec; + +mod service_status; +pub use self::service_status::ServiceStatus; + +mod session_affinity_config; +pub use self::session_affinity_config::SessionAffinityConfig; + +mod sleep_action; +pub use self::sleep_action::SleepAction; + +mod storage_os_persistent_volume_source; +pub use self::storage_os_persistent_volume_source::StorageOSPersistentVolumeSource; + +mod storage_os_volume_source; +pub use self::storage_os_volume_source::StorageOSVolumeSource; + +mod sysctl; +pub use self::sysctl::Sysctl; + +mod tcp_socket_action; +pub use self::tcp_socket_action::TCPSocketAction; + +mod taint; +pub use self::taint::Taint; + +mod toleration; +pub use self::toleration::Toleration; + +mod topology_selector_label_requirement; +pub use self::topology_selector_label_requirement::TopologySelectorLabelRequirement; + +mod topology_selector_term; +pub use self::topology_selector_term::TopologySelectorTerm; + +mod topology_spread_constraint; +pub use self::topology_spread_constraint::TopologySpreadConstraint; + +mod typed_local_object_reference; +pub use self::typed_local_object_reference::TypedLocalObjectReference; + +mod typed_object_reference; +pub use self::typed_object_reference::TypedObjectReference; + +mod volume; +pub use self::volume::Volume; + +mod volume_device; +pub use self::volume_device::VolumeDevice; + +mod volume_mount; +pub use self::volume_mount::VolumeMount; + +mod volume_mount_status; +pub use self::volume_mount_status::VolumeMountStatus; + +mod volume_node_affinity; +pub use self::volume_node_affinity::VolumeNodeAffinity; + +mod volume_projection; +pub use self::volume_projection::VolumeProjection; + +mod volume_resource_requirements; +pub use self::volume_resource_requirements::VolumeResourceRequirements; + +mod vsphere_virtual_disk_volume_source; +pub use self::vsphere_virtual_disk_volume_source::VsphereVirtualDiskVolumeSource; + +mod weighted_pod_affinity_term; +pub use self::weighted_pod_affinity_term::WeightedPodAffinityTerm; + +mod windows_security_context_options; +pub use self::windows_security_context_options::WindowsSecurityContextOptions; diff --git a/src/v1_30/api/core/v1/modify_volume_status.rs b/src/v1_30/api/core/v1/modify_volume_status.rs new file mode 100644 index 000000000..aad5b20a2 --- /dev/null +++ b/src/v1_30/api/core/v1/modify_volume_status.rs @@ -0,0 +1,162 @@ +// Generated from definition io.k8s.api.core.v1.ModifyVolumeStatus + +/// ModifyVolumeStatus represents the status object of ControllerModifyVolume operation +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ModifyVolumeStatus { + /// status is the status of the ControllerModifyVolume operation. It can be in any of following states: + /// - Pending + /// Pending indicates that the PersistentVolumeClaim cannot be modified due to unmet requirements, such as + /// the specified VolumeAttributesClass not existing. + /// - InProgress + /// InProgress indicates that the volume is being modified. + /// - Infeasible + /// Infeasible indicates that the request has been rejected as invalid by the CSI driver. To + /// resolve the error, a valid VolumeAttributesClass needs to be specified. + /// Note: New statuses can be added in the future. Consumers should check for unknown statuses and fail appropriately. + pub status: String, + + /// targetVolumeAttributesClassName is the name of the VolumeAttributesClass the PVC currently being reconciled + pub target_volume_attributes_class_name: Option, +} + +impl crate::DeepMerge for ModifyVolumeStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.target_volume_attributes_class_name, other.target_volume_attributes_class_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ModifyVolumeStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_status, + Key_target_volume_attributes_class_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "status" => Field::Key_status, + "targetVolumeAttributesClassName" => Field::Key_target_volume_attributes_class_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ModifyVolumeStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ModifyVolumeStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_status: Option = None; + let mut value_target_volume_attributes_class_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_volume_attributes_class_name => value_target_volume_attributes_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ModifyVolumeStatus { + status: value_status.unwrap_or_default(), + target_volume_attributes_class_name: value_target_volume_attributes_class_name, + }) + } + } + + deserializer.deserialize_struct( + "ModifyVolumeStatus", + &[ + "status", + "targetVolumeAttributesClassName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ModifyVolumeStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ModifyVolumeStatus", + 1 + + self.target_volume_attributes_class_name.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + if let Some(value) = &self.target_volume_attributes_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetVolumeAttributesClassName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ModifyVolumeStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ModifyVolumeStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ModifyVolumeStatus represents the status object of ControllerModifyVolume operation".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the status of the ControllerModifyVolume operation. It can be in any of following states:\n - Pending\n Pending indicates that the PersistentVolumeClaim cannot be modified due to unmet requirements, such as\n the specified VolumeAttributesClass not existing.\n - InProgress\n InProgress indicates that the volume is being modified.\n - Infeasible\n Infeasible indicates that the request has been rejected as invalid by the CSI driver. To\n\t resolve the error, a valid VolumeAttributesClass needs to be specified.\nNote: New statuses can be added in the future. Consumers should check for unknown statuses and fail appropriately.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "targetVolumeAttributesClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetVolumeAttributesClassName is the name of the VolumeAttributesClass the PVC currently being reconciled".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/namespace.rs b/src/v1_30/api/core/v1/namespace.rs new file mode 100644 index 000000000..e8af4455f --- /dev/null +++ b/src/v1_30/api/core/v1/namespace.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.Namespace + +/// Namespace provides a scope for Names. Use of multiple namespaces is optional. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Namespace { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Namespace { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Namespace"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "namespaces"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for Namespace { + const LIST_KIND: &'static str = "NamespaceList"; +} + +impl crate::Metadata for Namespace { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Namespace { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Namespace { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Namespace; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Namespace { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Namespace { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Namespace { + fn schema_name() -> String { + "io.k8s.api.core.v1.Namespace".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace provides a scope for Names. Use of multiple namespaces is optional.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/namespace_condition.rs b/src/v1_30/api/core/v1/namespace_condition.rs new file mode 100644 index 000000000..fd2158f5c --- /dev/null +++ b/src/v1_30/api/core/v1/namespace_condition.rs @@ -0,0 +1,208 @@ +// Generated from definition io.k8s.api.core.v1.NamespaceCondition + +/// NamespaceCondition contains details about state of namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamespaceCondition { + pub last_transition_time: Option, + + pub message: Option, + + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of namespace controller condition. + pub type_: String, +} + +impl crate::DeepMerge for NamespaceCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamespaceCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamespaceCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamespaceCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamespaceCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamespaceCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamespaceCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamespaceCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamespaceCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.NamespaceCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceCondition contains details about state of namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + __gen.subschema_for::(), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of namespace controller condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/namespace_spec.rs b/src/v1_30/api/core/v1/namespace_spec.rs new file mode 100644 index 000000000..cbf697e1e --- /dev/null +++ b/src/v1_30/api/core/v1/namespace_spec.rs @@ -0,0 +1,136 @@ +// Generated from definition io.k8s.api.core.v1.NamespaceSpec + +/// NamespaceSpec describes the attributes on a Namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamespaceSpec { + /// Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + pub finalizers: Option>, +} + +impl crate::DeepMerge for NamespaceSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.finalizers, other.finalizers); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamespaceSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_finalizers, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "finalizers" => Field::Key_finalizers, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamespaceSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamespaceSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_finalizers: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_finalizers => value_finalizers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamespaceSpec { + finalizers: value_finalizers, + }) + } + } + + deserializer.deserialize_struct( + "NamespaceSpec", + &[ + "finalizers", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamespaceSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamespaceSpec", + self.finalizers.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.finalizers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "finalizers", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamespaceSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.NamespaceSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceSpec describes the attributes on a Namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "finalizers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/namespace_status.rs b/src/v1_30/api/core/v1/namespace_status.rs new file mode 100644 index 000000000..cc0ad1531 --- /dev/null +++ b/src/v1_30/api/core/v1/namespace_status.rs @@ -0,0 +1,163 @@ +// Generated from definition io.k8s.api.core.v1.NamespaceStatus + +/// NamespaceStatus is information about the current status of a Namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamespaceStatus { + /// Represents the latest available observations of a namespace's current state. + pub conditions: Option>, + + /// Phase is the current lifecycle phase of the namespace. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ + pub phase: Option, +} + +impl crate::DeepMerge for NamespaceStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamespaceStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_phase, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "phase" => Field::Key_phase, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamespaceStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamespaceStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_phase: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamespaceStatus { + conditions: value_conditions, + phase: value_phase, + }) + } + } + + deserializer.deserialize_struct( + "NamespaceStatus", + &[ + "conditions", + "phase", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamespaceStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamespaceStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamespaceStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.NamespaceStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamespaceStatus is information about the current status of a Namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a namespace's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "phase".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Phase is the current lifecycle phase of the namespace. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/nfs_volume_source.rs b/src/v1_30/api/core/v1/nfs_volume_source.rs new file mode 100644 index 000000000..d452e8f91 --- /dev/null +++ b/src/v1_30/api/core/v1/nfs_volume_source.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.core.v1.NFSVolumeSource + +/// Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NFSVolumeSource { + /// path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + pub path: String, + + /// readOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + pub read_only: Option, + + /// server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + pub server: String, +} + +impl crate::DeepMerge for NFSVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.server, other.server); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NFSVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_path, + Key_read_only, + Key_server, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "path" => Field::Key_path, + "readOnly" => Field::Key_read_only, + "server" => Field::Key_server, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NFSVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NFSVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_path: Option = None; + let mut value_read_only: Option = None; + let mut value_server: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_server => value_server = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NFSVolumeSource { + path: value_path.unwrap_or_default(), + read_only: value_read_only, + server: value_server.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NFSVolumeSource", + &[ + "path", + "readOnly", + "server", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NFSVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NFSVolumeSource", + 2 + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "server", &self.server)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NFSVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.NFSVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "server".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "path".to_owned(), + "server".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node.rs b/src/v1_30/api/core/v1/node.rs new file mode 100644 index 000000000..e78962958 --- /dev/null +++ b/src/v1_30/api/core/v1/node.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.Node + +/// Node is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Node { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the behavior of a node. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Most recently observed status of the node. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Node { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Node"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "nodes"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for Node { + const LIST_KIND: &'static str = "NodeList"; +} + +impl crate::Metadata for Node { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Node { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Node { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Node; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Node { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Node { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Node { + fn schema_name() -> String { + "io.k8s.api.core.v1.Node".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Node is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the behavior of a node. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recently observed status of the node. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_address.rs b/src/v1_30/api/core/v1/node_address.rs new file mode 100644 index 000000000..b5c913a44 --- /dev/null +++ b/src/v1_30/api/core/v1/node_address.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.NodeAddress + +/// NodeAddress contains information for the node's address. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeAddress { + /// The node address. + pub address: String, + + /// Node address type, one of Hostname, ExternalIP or InternalIP. + pub type_: String, +} + +impl crate::DeepMerge for NodeAddress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.address, other.address); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeAddress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_address, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "address" => Field::Key_address, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeAddress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeAddress") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_address: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_address => value_address = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeAddress { + address: value_address.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NodeAddress", + &[ + "address", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeAddress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeAddress", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "address", &self.address)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeAddress { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeAddress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeAddress contains information for the node's address.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "address".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The node address.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Node address type, one of Hostname, ExternalIP or InternalIP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "address".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_affinity.rs b/src/v1_30/api/core/v1/node_affinity.rs new file mode 100644 index 000000000..dfd14357a --- /dev/null +++ b/src/v1_30/api/core/v1/node_affinity.rs @@ -0,0 +1,156 @@ +// Generated from definition io.k8s.api.core.v1.NodeAffinity + +/// Node affinity is a group of node affinity scheduling rules. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeAffinity { + /// The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred. + pub preferred_during_scheduling_ignored_during_execution: Option>, + + /// If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node. + pub required_during_scheduling_ignored_during_execution: Option, +} + +impl crate::DeepMerge for NodeAffinity { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.preferred_during_scheduling_ignored_during_execution, other.preferred_during_scheduling_ignored_during_execution); + crate::DeepMerge::merge_from(&mut self.required_during_scheduling_ignored_during_execution, other.required_during_scheduling_ignored_during_execution); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeAffinity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_preferred_during_scheduling_ignored_during_execution, + Key_required_during_scheduling_ignored_during_execution, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "preferredDuringSchedulingIgnoredDuringExecution" => Field::Key_preferred_during_scheduling_ignored_during_execution, + "requiredDuringSchedulingIgnoredDuringExecution" => Field::Key_required_during_scheduling_ignored_during_execution, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeAffinity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeAffinity") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_preferred_during_scheduling_ignored_during_execution: Option> = None; + let mut value_required_during_scheduling_ignored_during_execution: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_preferred_during_scheduling_ignored_during_execution => value_preferred_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_required_during_scheduling_ignored_during_execution => value_required_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeAffinity { + preferred_during_scheduling_ignored_during_execution: value_preferred_during_scheduling_ignored_during_execution, + required_during_scheduling_ignored_during_execution: value_required_during_scheduling_ignored_during_execution, + }) + } + } + + deserializer.deserialize_struct( + "NodeAffinity", + &[ + "preferredDuringSchedulingIgnoredDuringExecution", + "requiredDuringSchedulingIgnoredDuringExecution", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeAffinity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeAffinity", + self.preferred_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1) + + self.required_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.preferred_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preferredDuringSchedulingIgnoredDuringExecution", value)?; + } + if let Some(value) = &self.required_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requiredDuringSchedulingIgnoredDuringExecution", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeAffinity { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeAffinity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Node affinity is a group of node affinity scheduling rules.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "preferredDuringSchedulingIgnoredDuringExecution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "requiredDuringSchedulingIgnoredDuringExecution".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_condition.rs b/src/v1_30/api/core/v1/node_condition.rs new file mode 100644 index 000000000..5117fb26b --- /dev/null +++ b/src/v1_30/api/core/v1/node_condition.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.core.v1.NodeCondition + +/// NodeCondition contains condition information for a node. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeCondition { + /// Last time we got an update on a given condition. + pub last_heartbeat_time: Option, + + /// Last time the condition transit from one status to another. + pub last_transition_time: Option, + + /// Human readable message indicating details about last transition. + pub message: Option, + + /// (brief) reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of node condition. + pub type_: String, +} + +impl crate::DeepMerge for NodeCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_heartbeat_time, other.last_heartbeat_time); + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_heartbeat_time, + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastHeartbeatTime" => Field::Key_last_heartbeat_time, + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_heartbeat_time: Option = None; + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_heartbeat_time => value_last_heartbeat_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeCondition { + last_heartbeat_time: value_last_heartbeat_time, + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NodeCondition", + &[ + "lastHeartbeatTime", + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeCondition", + 2 + + self.last_heartbeat_time.as_ref().map_or(0, |_| 1) + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_heartbeat_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastHeartbeatTime", value)?; + } + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeCondition contains condition information for a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastHeartbeatTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time we got an update on a given condition.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transit from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Human readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("(brief) reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of node condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_config_source.rs b/src/v1_30/api/core/v1/node_config_source.rs new file mode 100644 index 000000000..baa5cd1a5 --- /dev/null +++ b/src/v1_30/api/core/v1/node_config_source.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.NodeConfigSource + +/// NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. This API is deprecated since 1.22 +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeConfigSource { + /// ConfigMap is a reference to a Node's ConfigMap + pub config_map: Option, +} + +impl crate::DeepMerge for NodeConfigSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.config_map, other.config_map); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeConfigSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_config_map, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "configMap" => Field::Key_config_map, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeConfigSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeConfigSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_config_map: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_config_map => value_config_map = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeConfigSource { + config_map: value_config_map, + }) + } + } + + deserializer.deserialize_struct( + "NodeConfigSource", + &[ + "configMap", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeConfigSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeConfigSource", + self.config_map.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.config_map { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMap", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeConfigSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeConfigSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. This API is deprecated since 1.22".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "configMap".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ConfigMap is a reference to a Node's ConfigMap".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_config_status.rs b/src/v1_30/api/core/v1/node_config_status.rs new file mode 100644 index 000000000..ebd731c42 --- /dev/null +++ b/src/v1_30/api/core/v1/node_config_status.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.NodeConfigStatus + +/// NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeConfigStatus { + /// Active reports the checkpointed config the node is actively using. Active will represent either the current version of the Assigned config, or the current LastKnownGood config, depending on whether attempting to use the Assigned config results in an error. + pub active: Option, + + /// Assigned reports the checkpointed config the node will try to use. When Node.Spec.ConfigSource is updated, the node checkpoints the associated config payload to local disk, along with a record indicating intended config. The node refers to this record to choose its config checkpoint, and reports this record in Assigned. Assigned only updates in the status after the record has been checkpointed to disk. When the Kubelet is restarted, it tries to make the Assigned config the Active config by loading and validating the checkpointed payload identified by Assigned. + pub assigned: Option, + + /// Error describes any problems reconciling the Spec.ConfigSource to the Active config. Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting to load or validate the Assigned config, etc. Errors may occur at different points while syncing config. Earlier errors (e.g. download or checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error by fixing the config assigned in Spec.ConfigSource. You can find additional information for debugging by searching the error message in the Kubelet log. Error is a human-readable description of the error state; machines can check whether or not Error is empty, but should not rely on the stability of the Error text across Kubelet versions. + pub error: Option, + + /// LastKnownGood reports the checkpointed config the node will fall back to when it encounters an error attempting to use the Assigned config. The Assigned config becomes the LastKnownGood config when the node determines that the Assigned config is stable and correct. This is currently implemented as a 10-minute soak period starting when the local record of Assigned config is updated. If the Assigned config is Active at the end of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, because the local default config is always assumed good. You should not make assumptions about the node's method of determining config stability and correctness, as this may change or become configurable in the future. + pub last_known_good: Option, +} + +impl crate::DeepMerge for NodeConfigStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.active, other.active); + crate::DeepMerge::merge_from(&mut self.assigned, other.assigned); + crate::DeepMerge::merge_from(&mut self.error, other.error); + crate::DeepMerge::merge_from(&mut self.last_known_good, other.last_known_good); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeConfigStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_active, + Key_assigned, + Key_error, + Key_last_known_good, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "active" => Field::Key_active, + "assigned" => Field::Key_assigned, + "error" => Field::Key_error, + "lastKnownGood" => Field::Key_last_known_good, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeConfigStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeConfigStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_active: Option = None; + let mut value_assigned: Option = None; + let mut value_error: Option = None; + let mut value_last_known_good: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_active => value_active = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_assigned => value_assigned = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_error => value_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_known_good => value_last_known_good = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeConfigStatus { + active: value_active, + assigned: value_assigned, + error: value_error, + last_known_good: value_last_known_good, + }) + } + } + + deserializer.deserialize_struct( + "NodeConfigStatus", + &[ + "active", + "assigned", + "error", + "lastKnownGood", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeConfigStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeConfigStatus", + self.active.as_ref().map_or(0, |_| 1) + + self.assigned.as_ref().map_or(0, |_| 1) + + self.error.as_ref().map_or(0, |_| 1) + + self.last_known_good.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.active { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "active", value)?; + } + if let Some(value) = &self.assigned { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "assigned", value)?; + } + if let Some(value) = &self.error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "error", value)?; + } + if let Some(value) = &self.last_known_good { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastKnownGood", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeConfigStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeConfigStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "active".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Active reports the checkpointed config the node is actively using. Active will represent either the current version of the Assigned config, or the current LastKnownGood config, depending on whether attempting to use the Assigned config results in an error.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "assigned".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Assigned reports the checkpointed config the node will try to use. When Node.Spec.ConfigSource is updated, the node checkpoints the associated config payload to local disk, along with a record indicating intended config. The node refers to this record to choose its config checkpoint, and reports this record in Assigned. Assigned only updates in the status after the record has been checkpointed to disk. When the Kubelet is restarted, it tries to make the Assigned config the Active config by loading and validating the checkpointed payload identified by Assigned.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "error".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Error describes any problems reconciling the Spec.ConfigSource to the Active config. Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting to load or validate the Assigned config, etc. Errors may occur at different points while syncing config. Earlier errors (e.g. download or checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error by fixing the config assigned in Spec.ConfigSource. You can find additional information for debugging by searching the error message in the Kubelet log. Error is a human-readable description of the error state; machines can check whether or not Error is empty, but should not rely on the stability of the Error text across Kubelet versions.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "lastKnownGood".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LastKnownGood reports the checkpointed config the node will fall back to when it encounters an error attempting to use the Assigned config. The Assigned config becomes the LastKnownGood config when the node determines that the Assigned config is stable and correct. This is currently implemented as a 10-minute soak period starting when the local record of Assigned config is updated. If the Assigned config is Active at the end of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, because the local default config is always assumed good. You should not make assumptions about the node's method of determining config stability and correctness, as this may change or become configurable in the future.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_daemon_endpoints.rs b/src/v1_30/api/core/v1/node_daemon_endpoints.rs new file mode 100644 index 000000000..656ba6b90 --- /dev/null +++ b/src/v1_30/api/core/v1/node_daemon_endpoints.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.NodeDaemonEndpoints + +/// NodeDaemonEndpoints lists ports opened by daemons running on the Node. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeDaemonEndpoints { + /// Endpoint on which Kubelet is listening. + pub kubelet_endpoint: Option, +} + +impl crate::DeepMerge for NodeDaemonEndpoints { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.kubelet_endpoint, other.kubelet_endpoint); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeDaemonEndpoints { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_kubelet_endpoint, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "kubeletEndpoint" => Field::Key_kubelet_endpoint, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeDaemonEndpoints; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeDaemonEndpoints") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_kubelet_endpoint: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_kubelet_endpoint => value_kubelet_endpoint = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeDaemonEndpoints { + kubelet_endpoint: value_kubelet_endpoint, + }) + } + } + + deserializer.deserialize_struct( + "NodeDaemonEndpoints", + &[ + "kubeletEndpoint", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeDaemonEndpoints { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeDaemonEndpoints", + self.kubelet_endpoint.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.kubelet_endpoint { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kubeletEndpoint", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeDaemonEndpoints { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeDaemonEndpoints".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeDaemonEndpoints lists ports opened by daemons running on the Node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "kubeletEndpoint".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Endpoint on which Kubelet is listening.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_runtime_handler.rs b/src/v1_30/api/core/v1/node_runtime_handler.rs new file mode 100644 index 000000000..1b3959079 --- /dev/null +++ b/src/v1_30/api/core/v1/node_runtime_handler.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.NodeRuntimeHandler + +/// NodeRuntimeHandler is a set of runtime handler information. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeRuntimeHandler { + /// Supported features. + pub features: Option, + + /// Runtime handler name. Empty for the default runtime handler. + pub name: Option, +} + +impl crate::DeepMerge for NodeRuntimeHandler { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.features, other.features); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeRuntimeHandler { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_features, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "features" => Field::Key_features, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeRuntimeHandler; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeRuntimeHandler") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_features: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_features => value_features = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeRuntimeHandler { + features: value_features, + name: value_name, + }) + } + } + + deserializer.deserialize_struct( + "NodeRuntimeHandler", + &[ + "features", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeRuntimeHandler { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeRuntimeHandler", + self.features.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.features { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "features", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeRuntimeHandler { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeRuntimeHandler".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeRuntimeHandler is a set of runtime handler information.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "features".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Supported features.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Runtime handler name. Empty for the default runtime handler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_runtime_handler_features.rs b/src/v1_30/api/core/v1/node_runtime_handler_features.rs new file mode 100644 index 000000000..bfaa0eb20 --- /dev/null +++ b/src/v1_30/api/core/v1/node_runtime_handler_features.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.NodeRuntimeHandlerFeatures + +/// NodeRuntimeHandlerFeatures is a set of runtime features. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeRuntimeHandlerFeatures { + /// RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts. + pub recursive_read_only_mounts: Option, +} + +impl crate::DeepMerge for NodeRuntimeHandlerFeatures { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.recursive_read_only_mounts, other.recursive_read_only_mounts); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeRuntimeHandlerFeatures { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_recursive_read_only_mounts, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "recursiveReadOnlyMounts" => Field::Key_recursive_read_only_mounts, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeRuntimeHandlerFeatures; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeRuntimeHandlerFeatures") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_recursive_read_only_mounts: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_recursive_read_only_mounts => value_recursive_read_only_mounts = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeRuntimeHandlerFeatures { + recursive_read_only_mounts: value_recursive_read_only_mounts, + }) + } + } + + deserializer.deserialize_struct( + "NodeRuntimeHandlerFeatures", + &[ + "recursiveReadOnlyMounts", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeRuntimeHandlerFeatures { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeRuntimeHandlerFeatures", + self.recursive_read_only_mounts.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.recursive_read_only_mounts { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "recursiveReadOnlyMounts", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeRuntimeHandlerFeatures { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeRuntimeHandlerFeatures".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeRuntimeHandlerFeatures is a set of runtime features.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "recursiveReadOnlyMounts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_selector.rs b/src/v1_30/api/core/v1/node_selector.rs new file mode 100644 index 000000000..997fba9ef --- /dev/null +++ b/src/v1_30/api/core/v1/node_selector.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.core.v1.NodeSelector + +/// A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeSelector { + /// Required. A list of node selector terms. The terms are ORed. + pub node_selector_terms: Vec, +} + +impl crate::DeepMerge for NodeSelector { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.node_selector_terms, other.node_selector_terms); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeSelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_node_selector_terms, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nodeSelectorTerms" => Field::Key_node_selector_terms, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeSelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeSelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_node_selector_terms: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_node_selector_terms => value_node_selector_terms = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeSelector { + node_selector_terms: value_node_selector_terms.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NodeSelector", + &[ + "nodeSelectorTerms", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeSelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeSelector", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelectorTerms", &self.node_selector_terms)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeSelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeSelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nodeSelectorTerms".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required. A list of node selector terms. The terms are ORed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "nodeSelectorTerms".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_selector_requirement.rs b/src/v1_30/api/core/v1/node_selector_requirement.rs new file mode 100644 index 000000000..d360d05de --- /dev/null +++ b/src/v1_30/api/core/v1/node_selector_requirement.rs @@ -0,0 +1,185 @@ +// Generated from definition io.k8s.api.core.v1.NodeSelectorRequirement + +/// A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeSelectorRequirement { + /// The label key that the selector applies to. + pub key: String, + + /// Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + pub operator: String, + + /// An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + pub values: Option>, +} + +impl crate::DeepMerge for NodeSelectorRequirement { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.operator, other.operator); + crate::merge_strategies::list::atomic(&mut self.values, other.values); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeSelectorRequirement { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_operator, + Key_values, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "operator" => Field::Key_operator, + "values" => Field::Key_values, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeSelectorRequirement; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeSelectorRequirement") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_operator: Option = None; + let mut value_values: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operator => value_operator = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_values => value_values = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeSelectorRequirement { + key: value_key.unwrap_or_default(), + operator: value_operator.unwrap_or_default(), + values: value_values, + }) + } + } + + deserializer.deserialize_struct( + "NodeSelectorRequirement", + &[ + "key", + "operator", + "values", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeSelectorRequirement { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeSelectorRequirement", + 2 + + self.values.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operator", &self.operator)?; + if let Some(value) = &self.values { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "values", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeSelectorRequirement { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeSelectorRequirement".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The label key that the selector applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operator".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "values".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "operator".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_selector_term.rs b/src/v1_30/api/core/v1/node_selector_term.rs new file mode 100644 index 000000000..123788367 --- /dev/null +++ b/src/v1_30/api/core/v1/node_selector_term.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.core.v1.NodeSelectorTerm + +/// A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeSelectorTerm { + /// A list of node selector requirements by node's labels. + pub match_expressions: Option>, + + /// A list of node selector requirements by node's fields. + pub match_fields: Option>, +} + +impl crate::DeepMerge for NodeSelectorTerm { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.match_expressions, other.match_expressions); + crate::merge_strategies::list::atomic(&mut self.match_fields, other.match_fields); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeSelectorTerm { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_expressions, + Key_match_fields, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchExpressions" => Field::Key_match_expressions, + "matchFields" => Field::Key_match_fields, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeSelectorTerm; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeSelectorTerm") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_expressions: Option> = None; + let mut value_match_fields: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_expressions => value_match_expressions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_fields => value_match_fields = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeSelectorTerm { + match_expressions: value_match_expressions, + match_fields: value_match_fields, + }) + } + } + + deserializer.deserialize_struct( + "NodeSelectorTerm", + &[ + "matchExpressions", + "matchFields", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeSelectorTerm { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeSelectorTerm", + self.match_expressions.as_ref().map_or(0, |_| 1) + + self.match_fields.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_expressions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchExpressions", value)?; + } + if let Some(value) = &self.match_fields { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchFields", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeSelectorTerm { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeSelectorTerm".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchExpressions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of node selector requirements by node's labels.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchFields".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of node selector requirements by node's fields.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_spec.rs b/src/v1_30/api/core/v1/node_spec.rs new file mode 100644 index 000000000..5bcb728b2 --- /dev/null +++ b/src/v1_30/api/core/v1/node_spec.rs @@ -0,0 +1,290 @@ +// Generated from definition io.k8s.api.core.v1.NodeSpec + +/// NodeSpec describes the attributes that a node is created with. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeSpec { + /// Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed. + pub config_source: Option, + + /// Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966 + pub external_id: Option, + + /// PodCIDR represents the pod IP range assigned to the node. + pub pod_cidr: Option, + + /// podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6. + pub pod_cidrs: Option>, + + /// ID of the node assigned by the cloud provider in the format: \://\ + pub provider_id: Option, + + /// If specified, the node's taints. + pub taints: Option>, + + /// Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration + pub unschedulable: Option, +} + +impl crate::DeepMerge for NodeSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.config_source, other.config_source); + crate::DeepMerge::merge_from(&mut self.external_id, other.external_id); + crate::DeepMerge::merge_from(&mut self.pod_cidr, other.pod_cidr); + crate::merge_strategies::list::set(&mut self.pod_cidrs, other.pod_cidrs); + crate::DeepMerge::merge_from(&mut self.provider_id, other.provider_id); + crate::merge_strategies::list::atomic(&mut self.taints, other.taints); + crate::DeepMerge::merge_from(&mut self.unschedulable, other.unschedulable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_config_source, + Key_external_id, + Key_pod_cidr, + Key_pod_cidrs, + Key_provider_id, + Key_taints, + Key_unschedulable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "configSource" => Field::Key_config_source, + "externalID" => Field::Key_external_id, + "podCIDR" => Field::Key_pod_cidr, + "podCIDRs" => Field::Key_pod_cidrs, + "providerID" => Field::Key_provider_id, + "taints" => Field::Key_taints, + "unschedulable" => Field::Key_unschedulable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_config_source: Option = None; + let mut value_external_id: Option = None; + let mut value_pod_cidr: Option = None; + let mut value_pod_cidrs: Option> = None; + let mut value_provider_id: Option = None; + let mut value_taints: Option> = None; + let mut value_unschedulable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_config_source => value_config_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external_id => value_external_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_cidr => value_pod_cidr = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_cidrs => value_pod_cidrs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_provider_id => value_provider_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_taints => value_taints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_unschedulable => value_unschedulable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeSpec { + config_source: value_config_source, + external_id: value_external_id, + pod_cidr: value_pod_cidr, + pod_cidrs: value_pod_cidrs, + provider_id: value_provider_id, + taints: value_taints, + unschedulable: value_unschedulable, + }) + } + } + + deserializer.deserialize_struct( + "NodeSpec", + &[ + "configSource", + "externalID", + "podCIDR", + "podCIDRs", + "providerID", + "taints", + "unschedulable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeSpec", + self.config_source.as_ref().map_or(0, |_| 1) + + self.external_id.as_ref().map_or(0, |_| 1) + + self.pod_cidr.as_ref().map_or(0, |_| 1) + + self.pod_cidrs.as_ref().map_or(0, |_| 1) + + self.provider_id.as_ref().map_or(0, |_| 1) + + self.taints.as_ref().map_or(0, |_| 1) + + self.unschedulable.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.config_source { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configSource", value)?; + } + if let Some(value) = &self.external_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "externalID", value)?; + } + if let Some(value) = &self.pod_cidr { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podCIDR", value)?; + } + if let Some(value) = &self.pod_cidrs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podCIDRs", value)?; + } + if let Some(value) = &self.provider_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "providerID", value)?; + } + if let Some(value) = &self.taints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "taints", value)?; + } + if let Some(value) = &self.unschedulable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "unschedulable", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeSpec describes the attributes that a node is created with.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "configSource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "externalID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "podCIDR".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodCIDR represents the pod IP range assigned to the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "podCIDRs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "providerID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ID of the node assigned by the cloud provider in the format: ://".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "taints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the node's taints.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "unschedulable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_status.rs b/src/v1_30/api/core/v1/node_status.rs new file mode 100644 index 000000000..49cbf241d --- /dev/null +++ b/src/v1_30/api/core/v1/node_status.rs @@ -0,0 +1,457 @@ +// Generated from definition io.k8s.api.core.v1.NodeStatus + +/// NodeStatus is information about the current status of a node. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeStatus { + /// List of addresses reachable to the node. Queried from cloud provider, if available. More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses Note: This field is declared as mergeable, but the merge key is not sufficiently unique, which can cause data corruption when it is merged. Callers should instead use a full-replacement patch. See https://pr.k8s.io/79391 for an example. Consumers should assume that addresses can change during the lifetime of a Node. However, there are some exceptions where this may not be possible, such as Pods that inherit a Node's address in its own status or consumers of the downward API (status.hostIP). + pub addresses: Option>, + + /// Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity. + pub allocatable: Option>, + + /// Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity + pub capacity: Option>, + + /// Conditions is an array of current observed node conditions. More info: https://kubernetes.io/docs/concepts/nodes/node/#condition + pub conditions: Option>, + + /// Status of the config assigned to the node via the dynamic Kubelet config feature. + pub config: Option, + + /// Endpoints of daemons running on the Node. + pub daemon_endpoints: Option, + + /// List of container images on this node + pub images: Option>, + + /// Set of ids/uuids to uniquely identify the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#info + pub node_info: Option, + + /// NodePhase is the recently observed lifecycle phase of the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated. + pub phase: Option, + + /// The available runtime handlers. + pub runtime_handlers: Option>, + + /// List of volumes that are attached to the node. + pub volumes_attached: Option>, + + /// List of attachable volumes in use (mounted) by the node. + pub volumes_in_use: Option>, +} + +impl crate::DeepMerge for NodeStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.addresses, + other.addresses, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::map::granular(&mut self.allocatable, other.allocatable, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.config, other.config); + crate::DeepMerge::merge_from(&mut self.daemon_endpoints, other.daemon_endpoints); + crate::merge_strategies::list::atomic(&mut self.images, other.images); + crate::DeepMerge::merge_from(&mut self.node_info, other.node_info); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + crate::merge_strategies::list::atomic(&mut self.runtime_handlers, other.runtime_handlers); + crate::merge_strategies::list::atomic(&mut self.volumes_attached, other.volumes_attached); + crate::merge_strategies::list::atomic(&mut self.volumes_in_use, other.volumes_in_use); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_addresses, + Key_allocatable, + Key_capacity, + Key_conditions, + Key_config, + Key_daemon_endpoints, + Key_images, + Key_node_info, + Key_phase, + Key_runtime_handlers, + Key_volumes_attached, + Key_volumes_in_use, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "addresses" => Field::Key_addresses, + "allocatable" => Field::Key_allocatable, + "capacity" => Field::Key_capacity, + "conditions" => Field::Key_conditions, + "config" => Field::Key_config, + "daemonEndpoints" => Field::Key_daemon_endpoints, + "images" => Field::Key_images, + "nodeInfo" => Field::Key_node_info, + "phase" => Field::Key_phase, + "runtimeHandlers" => Field::Key_runtime_handlers, + "volumesAttached" => Field::Key_volumes_attached, + "volumesInUse" => Field::Key_volumes_in_use, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_addresses: Option> = None; + let mut value_allocatable: Option> = None; + let mut value_capacity: Option> = None; + let mut value_conditions: Option> = None; + let mut value_config: Option = None; + let mut value_daemon_endpoints: Option = None; + let mut value_images: Option> = None; + let mut value_node_info: Option = None; + let mut value_phase: Option = None; + let mut value_runtime_handlers: Option> = None; + let mut value_volumes_attached: Option> = None; + let mut value_volumes_in_use: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_addresses => value_addresses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_allocatable => value_allocatable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_config => value_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_daemon_endpoints => value_daemon_endpoints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_images => value_images = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_info => value_node_info = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_runtime_handlers => value_runtime_handlers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volumes_attached => value_volumes_attached = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volumes_in_use => value_volumes_in_use = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeStatus { + addresses: value_addresses, + allocatable: value_allocatable, + capacity: value_capacity, + conditions: value_conditions, + config: value_config, + daemon_endpoints: value_daemon_endpoints, + images: value_images, + node_info: value_node_info, + phase: value_phase, + runtime_handlers: value_runtime_handlers, + volumes_attached: value_volumes_attached, + volumes_in_use: value_volumes_in_use, + }) + } + } + + deserializer.deserialize_struct( + "NodeStatus", + &[ + "addresses", + "allocatable", + "capacity", + "conditions", + "config", + "daemonEndpoints", + "images", + "nodeInfo", + "phase", + "runtimeHandlers", + "volumesAttached", + "volumesInUse", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeStatus", + self.addresses.as_ref().map_or(0, |_| 1) + + self.allocatable.as_ref().map_or(0, |_| 1) + + self.capacity.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.config.as_ref().map_or(0, |_| 1) + + self.daemon_endpoints.as_ref().map_or(0, |_| 1) + + self.images.as_ref().map_or(0, |_| 1) + + self.node_info.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1) + + self.runtime_handlers.as_ref().map_or(0, |_| 1) + + self.volumes_attached.as_ref().map_or(0, |_| 1) + + self.volumes_in_use.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.addresses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "addresses", value)?; + } + if let Some(value) = &self.allocatable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocatable", value)?; + } + if let Some(value) = &self.capacity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.config { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "config", value)?; + } + if let Some(value) = &self.daemon_endpoints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "daemonEndpoints", value)?; + } + if let Some(value) = &self.images { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "images", value)?; + } + if let Some(value) = &self.node_info { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeInfo", value)?; + } + if let Some(value) = &self.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + if let Some(value) = &self.runtime_handlers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runtimeHandlers", value)?; + } + if let Some(value) = &self.volumes_attached { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumesAttached", value)?; + } + if let Some(value) = &self.volumes_in_use { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumesInUse", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeStatus is information about the current status of a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "addresses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of addresses reachable to the node. Queried from cloud provider, if available. More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses Note: This field is declared as mergeable, but the merge key is not sufficiently unique, which can cause data corruption when it is merged. Callers should instead use a full-replacement patch. See https://pr.k8s.io/79391 for an example. Consumers should assume that addresses can change during the lifetime of a Node. However, there are some exceptions where this may not be possible, such as Pods that inherit a Node's address in its own status or consumers of the downward API (status.hostIP).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "allocatable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "capacity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Conditions is an array of current observed node conditions. More info: https://kubernetes.io/docs/concepts/nodes/node/#condition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "config".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the config assigned to the node via the dynamic Kubelet config feature.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "daemonEndpoints".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Endpoints of daemons running on the Node.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "images".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of container images on this node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "nodeInfo".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Set of ids/uuids to uniquely identify the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#info".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "phase".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodePhase is the recently observed lifecycle phase of the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "runtimeHandlers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The available runtime handlers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumesAttached".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of volumes that are attached to the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumesInUse".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of attachable volumes in use (mounted) by the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/node_system_info.rs b/src/v1_30/api/core/v1/node_system_info.rs new file mode 100644 index 000000000..71af573ca --- /dev/null +++ b/src/v1_30/api/core/v1/node_system_info.rs @@ -0,0 +1,335 @@ +// Generated from definition io.k8s.api.core.v1.NodeSystemInfo + +/// NodeSystemInfo is a set of ids/uuids to uniquely identify the node. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NodeSystemInfo { + /// The Architecture reported by the node + pub architecture: String, + + /// Boot ID reported by the node. + pub boot_id: String, + + /// ContainerRuntime Version reported by the node through runtime remote API (e.g. containerd://1.4.2). + pub container_runtime_version: String, + + /// Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). + pub kernel_version: String, + + /// KubeProxy Version reported by the node. + pub kube_proxy_version: String, + + /// Kubelet Version reported by the node. + pub kubelet_version: String, + + /// MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html + pub machine_id: String, + + /// The Operating System reported by the node + pub operating_system: String, + + /// OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). + pub os_image: String, + + /// SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid + pub system_uuid: String, +} + +impl crate::DeepMerge for NodeSystemInfo { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.architecture, other.architecture); + crate::DeepMerge::merge_from(&mut self.boot_id, other.boot_id); + crate::DeepMerge::merge_from(&mut self.container_runtime_version, other.container_runtime_version); + crate::DeepMerge::merge_from(&mut self.kernel_version, other.kernel_version); + crate::DeepMerge::merge_from(&mut self.kube_proxy_version, other.kube_proxy_version); + crate::DeepMerge::merge_from(&mut self.kubelet_version, other.kubelet_version); + crate::DeepMerge::merge_from(&mut self.machine_id, other.machine_id); + crate::DeepMerge::merge_from(&mut self.operating_system, other.operating_system); + crate::DeepMerge::merge_from(&mut self.os_image, other.os_image); + crate::DeepMerge::merge_from(&mut self.system_uuid, other.system_uuid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NodeSystemInfo { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_architecture, + Key_boot_id, + Key_container_runtime_version, + Key_kernel_version, + Key_kube_proxy_version, + Key_kubelet_version, + Key_machine_id, + Key_operating_system, + Key_os_image, + Key_system_uuid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "architecture" => Field::Key_architecture, + "bootID" => Field::Key_boot_id, + "containerRuntimeVersion" => Field::Key_container_runtime_version, + "kernelVersion" => Field::Key_kernel_version, + "kubeProxyVersion" => Field::Key_kube_proxy_version, + "kubeletVersion" => Field::Key_kubelet_version, + "machineID" => Field::Key_machine_id, + "operatingSystem" => Field::Key_operating_system, + "osImage" => Field::Key_os_image, + "systemUUID" => Field::Key_system_uuid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NodeSystemInfo; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NodeSystemInfo") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_architecture: Option = None; + let mut value_boot_id: Option = None; + let mut value_container_runtime_version: Option = None; + let mut value_kernel_version: Option = None; + let mut value_kube_proxy_version: Option = None; + let mut value_kubelet_version: Option = None; + let mut value_machine_id: Option = None; + let mut value_operating_system: Option = None; + let mut value_os_image: Option = None; + let mut value_system_uuid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_architecture => value_architecture = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_boot_id => value_boot_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_container_runtime_version => value_container_runtime_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kernel_version => value_kernel_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kube_proxy_version => value_kube_proxy_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kubelet_version => value_kubelet_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_machine_id => value_machine_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operating_system => value_operating_system = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_os_image => value_os_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_system_uuid => value_system_uuid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NodeSystemInfo { + architecture: value_architecture.unwrap_or_default(), + boot_id: value_boot_id.unwrap_or_default(), + container_runtime_version: value_container_runtime_version.unwrap_or_default(), + kernel_version: value_kernel_version.unwrap_or_default(), + kube_proxy_version: value_kube_proxy_version.unwrap_or_default(), + kubelet_version: value_kubelet_version.unwrap_or_default(), + machine_id: value_machine_id.unwrap_or_default(), + operating_system: value_operating_system.unwrap_or_default(), + os_image: value_os_image.unwrap_or_default(), + system_uuid: value_system_uuid.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NodeSystemInfo", + &[ + "architecture", + "bootID", + "containerRuntimeVersion", + "kernelVersion", + "kubeProxyVersion", + "kubeletVersion", + "machineID", + "operatingSystem", + "osImage", + "systemUUID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NodeSystemInfo { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NodeSystemInfo", + 10, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "architecture", &self.architecture)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bootID", &self.boot_id)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerRuntimeVersion", &self.container_runtime_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kernelVersion", &self.kernel_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kubeProxyVersion", &self.kube_proxy_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kubeletVersion", &self.kubelet_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "machineID", &self.machine_id)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operatingSystem", &self.operating_system)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "osImage", &self.os_image)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "systemUUID", &self.system_uuid)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NodeSystemInfo { + fn schema_name() -> String { + "io.k8s.api.core.v1.NodeSystemInfo".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeSystemInfo is a set of ids/uuids to uniquely identify the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "architecture".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Architecture reported by the node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "bootID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Boot ID reported by the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "containerRuntimeVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ContainerRuntime Version reported by the node through runtime remote API (e.g. containerd://1.4.2).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kernelVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kubeProxyVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("KubeProxy Version reported by the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kubeletVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kubelet Version reported by the node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "machineID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operatingSystem".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Operating System reported by the node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "osImage".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "systemUUID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "architecture".to_owned(), + "bootID".to_owned(), + "containerRuntimeVersion".to_owned(), + "kernelVersion".to_owned(), + "kubeProxyVersion".to_owned(), + "kubeletVersion".to_owned(), + "machineID".to_owned(), + "operatingSystem".to_owned(), + "osImage".to_owned(), + "systemUUID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/object_field_selector.rs b/src/v1_30/api/core/v1/object_field_selector.rs new file mode 100644 index 000000000..093a425d3 --- /dev/null +++ b/src/v1_30/api/core/v1/object_field_selector.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.ObjectFieldSelector + +/// ObjectFieldSelector selects an APIVersioned field of an object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ObjectFieldSelector { + /// Version of the schema the FieldPath is written in terms of, defaults to "v1". + pub api_version: Option, + + /// Path of the field to select in the specified API version. + pub field_path: String, +} + +impl crate::DeepMerge for ObjectFieldSelector { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.field_path, other.field_path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ObjectFieldSelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_field_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "fieldPath" => Field::Key_field_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ObjectFieldSelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectFieldSelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_field_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_field_path => value_field_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ObjectFieldSelector { + api_version: value_api_version, + field_path: value_field_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ObjectFieldSelector", + &[ + "apiVersion", + "fieldPath", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ObjectFieldSelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectFieldSelector", + 1 + + self.api_version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldPath", &self.field_path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ObjectFieldSelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.ObjectFieldSelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectFieldSelector selects an APIVersioned field of an object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Version of the schema the FieldPath is written in terms of, defaults to \"v1\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fieldPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Path of the field to select in the specified API version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "fieldPath".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/object_reference.rs b/src/v1_30/api/core/v1/object_reference.rs new file mode 100644 index 000000000..57c443675 --- /dev/null +++ b/src/v1_30/api/core/v1/object_reference.rs @@ -0,0 +1,277 @@ +// Generated from definition io.k8s.api.core.v1.ObjectReference + +/// ObjectReference contains enough information to let you inspect or modify the referred object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ObjectReference { + /// API version of the referent. + pub api_version: Option, + + /// If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers\[2\]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers\[2\]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. + pub field_path: Option, + + /// Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub kind: Option, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + pub namespace: Option, + + /// Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + pub resource_version: Option, + + /// UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + pub uid: Option, +} + +impl crate::DeepMerge for ObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.field_path, other.field_path); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_field_path, + Key_kind, + Key_name, + Key_namespace, + Key_resource_version, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "fieldPath" => Field::Key_field_path, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "resourceVersion" => Field::Key_resource_version, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_field_path: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_resource_version: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_field_path => value_field_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ObjectReference { + api_version: value_api_version, + field_path: value_field_path, + kind: value_kind, + name: value_name, + namespace: value_namespace, + resource_version: value_resource_version, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "ObjectReference", + &[ + "apiVersion", + "fieldPath", + "kind", + "name", + "namespace", + "resourceVersion", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectReference", + self.api_version.as_ref().map_or(0, |_| 1) + + self.field_path.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.resource_version.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.field_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldPath", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ObjectReference { + fn schema_name() -> String { + "io.k8s.api.core.v1.ObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectReference contains enough information to let you inspect or modify the referred object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("API version of the referent.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fieldPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume.rs b/src/v1_30/api/core/v1/persistent_volume.rs new file mode 100644 index 000000000..7cb7fa7a7 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolume + +/// PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolume { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes + pub spec: Option, + + /// status represents the current information/status for the persistent volume. Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes + pub status: Option, +} + +impl crate::Resource for PersistentVolume { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "PersistentVolume"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "persistentvolumes"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for PersistentVolume { + const LIST_KIND: &'static str = "PersistentVolumeList"; +} + +impl crate::Metadata for PersistentVolume { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PersistentVolume { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolume { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolume; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolume { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolume { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolume { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolume".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status represents the current information/status for the persistent volume. Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim.rs b/src/v1_30/api/core/v1/persistent_volume_claim.rs new file mode 100644 index 000000000..f6ab75b14 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaim + +/// PersistentVolumeClaim is a user's request for and claim to a persistent volume +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaim { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + pub spec: Option, + + /// status represents the current information/status of a persistent volume claim. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + pub status: Option, +} + +impl crate::Resource for PersistentVolumeClaim { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "PersistentVolumeClaim"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "persistentvolumeclaims"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for PersistentVolumeClaim { + const LIST_KIND: &'static str = "PersistentVolumeClaimList"; +} + +impl crate::Metadata for PersistentVolumeClaim { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PersistentVolumeClaim { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaim { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaim; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaim { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaim { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaim { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaim".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaim is a user's request for and claim to a persistent volume".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status represents the current information/status of a persistent volume claim. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim_condition.rs b/src/v1_30/api/core/v1/persistent_volume_claim_condition.rs new file mode 100644 index 000000000..13a5e7e17 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim_condition.rs @@ -0,0 +1,241 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimCondition + +/// PersistentVolumeClaimCondition contains details about state of pvc +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaimCondition { + /// lastProbeTime is the time we probed the condition. + pub last_probe_time: Option, + + /// lastTransitionTime is the time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// message is the human-readable message indicating details about last transition. + pub message: Option, + + /// reason is a unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports "Resizing" that means the underlying persistent volume is being resized. + pub reason: Option, + + pub status: String, + + pub type_: String, +} + +impl crate::DeepMerge for PersistentVolumeClaimCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_probe_time, other.last_probe_time); + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaimCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_probe_time, + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastProbeTime" => Field::Key_last_probe_time, + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaimCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeClaimCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_probe_time: Option = None; + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_probe_time => value_last_probe_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaimCondition { + last_probe_time: value_last_probe_time, + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimCondition", + &[ + "lastProbeTime", + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaimCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeClaimCondition", + 2 + + self.last_probe_time.as_ref().map_or(0, |_| 1) + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_probe_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastProbeTime", value)?; + } + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaimCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaimCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaimCondition contains details about state of pvc".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastProbeTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastProbeTime is the time we probed the condition.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastTransitionTime is the time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message is the human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason is a unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"Resizing\" that means the underlying persistent volume is being resized.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim_spec.rs b/src/v1_30/api/core/v1/persistent_volume_claim_spec.rs new file mode 100644 index 000000000..647c2bb96 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim_spec.rs @@ -0,0 +1,343 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimSpec + +/// PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaimSpec { + /// accessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + pub access_modes: Option>, + + /// dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource. + pub data_source: Option, + + /// dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef + /// allows any non-core object, as well as PersistentVolumeClaim objects. + /// * While dataSource ignores disallowed values (dropping them), dataSourceRef + /// preserves all values, and generates an error if a disallowed value is + /// specified. + /// * While dataSource only allows local objects, dataSourceRef allows objects + /// in any namespaces. + /// (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + pub data_source_ref: Option, + + /// resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + pub resources: Option, + + /// selector is a label query over volumes to consider for binding. + pub selector: Option, + + /// storageClassName is the name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + pub storage_class_name: Option, + + /// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it's not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled. + pub volume_attributes_class_name: Option, + + /// volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. + pub volume_mode: Option, + + /// volumeName is the binding reference to the PersistentVolume backing this claim. + pub volume_name: Option, +} + +impl crate::DeepMerge for PersistentVolumeClaimSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.access_modes, other.access_modes); + crate::DeepMerge::merge_from(&mut self.data_source, other.data_source); + crate::DeepMerge::merge_from(&mut self.data_source_ref, other.data_source_ref); + crate::DeepMerge::merge_from(&mut self.resources, other.resources); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.storage_class_name, other.storage_class_name); + crate::DeepMerge::merge_from(&mut self.volume_attributes_class_name, other.volume_attributes_class_name); + crate::DeepMerge::merge_from(&mut self.volume_mode, other.volume_mode); + crate::DeepMerge::merge_from(&mut self.volume_name, other.volume_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaimSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_access_modes, + Key_data_source, + Key_data_source_ref, + Key_resources, + Key_selector, + Key_storage_class_name, + Key_volume_attributes_class_name, + Key_volume_mode, + Key_volume_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "accessModes" => Field::Key_access_modes, + "dataSource" => Field::Key_data_source, + "dataSourceRef" => Field::Key_data_source_ref, + "resources" => Field::Key_resources, + "selector" => Field::Key_selector, + "storageClassName" => Field::Key_storage_class_name, + "volumeAttributesClassName" => Field::Key_volume_attributes_class_name, + "volumeMode" => Field::Key_volume_mode, + "volumeName" => Field::Key_volume_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaimSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeClaimSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_access_modes: Option> = None; + let mut value_data_source: Option = None; + let mut value_data_source_ref: Option = None; + let mut value_resources: Option = None; + let mut value_selector: Option = None; + let mut value_storage_class_name: Option = None; + let mut value_volume_attributes_class_name: Option = None; + let mut value_volume_mode: Option = None; + let mut value_volume_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_access_modes => value_access_modes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_data_source => value_data_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_data_source_ref => value_data_source_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_class_name => value_storage_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_attributes_class_name => value_volume_attributes_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_mode => value_volume_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_name => value_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaimSpec { + access_modes: value_access_modes, + data_source: value_data_source, + data_source_ref: value_data_source_ref, + resources: value_resources, + selector: value_selector, + storage_class_name: value_storage_class_name, + volume_attributes_class_name: value_volume_attributes_class_name, + volume_mode: value_volume_mode, + volume_name: value_volume_name, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimSpec", + &[ + "accessModes", + "dataSource", + "dataSourceRef", + "resources", + "selector", + "storageClassName", + "volumeAttributesClassName", + "volumeMode", + "volumeName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaimSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeClaimSpec", + self.access_modes.as_ref().map_or(0, |_| 1) + + self.data_source.as_ref().map_or(0, |_| 1) + + self.data_source_ref.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1) + + self.storage_class_name.as_ref().map_or(0, |_| 1) + + self.volume_attributes_class_name.as_ref().map_or(0, |_| 1) + + self.volume_mode.as_ref().map_or(0, |_| 1) + + self.volume_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.access_modes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "accessModes", value)?; + } + if let Some(value) = &self.data_source { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dataSource", value)?; + } + if let Some(value) = &self.data_source_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dataSourceRef", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + if let Some(value) = &self.storage_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageClassName", value)?; + } + if let Some(value) = &self.volume_attributes_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeAttributesClassName", value)?; + } + if let Some(value) = &self.volume_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMode", value)?; + } + if let Some(value) = &self.volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaimSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaimSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "accessModes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("accessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "dataSource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "dataSourceRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef\n allows any non-core object, as well as PersistentVolumeClaim objects.\n* While dataSource ignores disallowed values (dropping them), dataSourceRef\n preserves all values, and generates an error if a disallowed value is\n specified.\n* While dataSource only allows local objects, dataSourceRef allows objects\n in any namespaces.\n(Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selector is a label query over volumes to consider for binding.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "storageClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageClassName is the name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeAttributesClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it's not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeName is the binding reference to the PersistentVolume backing this claim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim_status.rs b/src/v1_30/api/core/v1/persistent_volume_claim_status.rs new file mode 100644 index 000000000..7aa596d23 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim_status.rs @@ -0,0 +1,384 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimStatus + +/// PersistentVolumeClaimStatus is the current status of a persistent volume claim. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaimStatus { + /// accessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + pub access_modes: Option>, + + /// allocatedResourceStatuses stores status of resource being resized for the given PVC. Key names follow standard Kubernetes label syntax. Valid values are either: + /// * Un-prefixed keys: + /// - storage - the capacity of the volume. + /// * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" + /// Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. + /// + /// ClaimResourceStatus can be in any of following states: + /// - ControllerResizeInProgress: + /// State set when resize controller starts resizing the volume in control-plane. + /// - ControllerResizeFailed: + /// State set when resize has failed in resize controller with a terminal error. + /// - NodeResizePending: + /// State set when resize controller has finished resizing the volume but further resizing of + /// volume is needed on the node. + /// - NodeResizeInProgress: + /// State set when kubelet starts resizing the volume. + /// - NodeResizeFailed: + /// State set when resizing has failed in kubelet with a terminal error. Transient errors don't set + /// NodeResizeFailed. + /// For example: if expanding a PVC for more capacity - this field can be one of the following states: + /// - pvc.status.allocatedResourceStatus\['storage'\] = "ControllerResizeInProgress" + /// - pvc.status.allocatedResourceStatus\['storage'\] = "ControllerResizeFailed" + /// - pvc.status.allocatedResourceStatus\['storage'\] = "NodeResizePending" + /// - pvc.status.allocatedResourceStatus\['storage'\] = "NodeResizeInProgress" + /// - pvc.status.allocatedResourceStatus\['storage'\] = "NodeResizeFailed" + /// When this field is not set, it means that no resize operation is in progress for the given PVC. + /// + /// A controller that receives PVC update with previously unknown resourceName or ClaimResourceStatus should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC. + /// + /// This is an alpha field and requires enabling RecoverVolumeExpansionFailure feature. + pub allocated_resource_statuses: Option>, + + /// allocatedResources tracks the resources allocated to a PVC including its capacity. Key names follow standard Kubernetes label syntax. Valid values are either: + /// * Un-prefixed keys: + /// - storage - the capacity of the volume. + /// * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" + /// Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. + /// + /// Capacity reported here may be larger than the actual capacity when a volume expansion operation is requested. For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. If allocatedResources is not set, PVC.spec.resources alone is used for quota calculation. If a volume expansion capacity request is lowered, allocatedResources is only lowered if there are no expansion operations in progress and if the actual volume capacity is equal or lower than the requested capacity. + /// + /// A controller that receives PVC update with previously unknown resourceName should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC. + /// + /// This is an alpha field and requires enabling RecoverVolumeExpansionFailure feature. + pub allocated_resources: Option>, + + /// capacity represents the actual resources of the underlying volume. + pub capacity: Option>, + + /// conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'Resizing'. + pub conditions: Option>, + + /// currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim This is an alpha field and requires enabling VolumeAttributesClass feature. + pub current_volume_attributes_class_name: Option, + + /// ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. This is an alpha field and requires enabling VolumeAttributesClass feature. + pub modify_volume_status: Option, + + /// phase represents the current phase of PersistentVolumeClaim. + pub phase: Option, +} + +impl crate::DeepMerge for PersistentVolumeClaimStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.access_modes, other.access_modes); + crate::merge_strategies::map::granular(&mut self.allocated_resource_statuses, other.allocated_resource_statuses, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.allocated_resources, other.allocated_resources, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.current_volume_attributes_class_name, other.current_volume_attributes_class_name); + crate::DeepMerge::merge_from(&mut self.modify_volume_status, other.modify_volume_status); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaimStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_access_modes, + Key_allocated_resource_statuses, + Key_allocated_resources, + Key_capacity, + Key_conditions, + Key_current_volume_attributes_class_name, + Key_modify_volume_status, + Key_phase, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "accessModes" => Field::Key_access_modes, + "allocatedResourceStatuses" => Field::Key_allocated_resource_statuses, + "allocatedResources" => Field::Key_allocated_resources, + "capacity" => Field::Key_capacity, + "conditions" => Field::Key_conditions, + "currentVolumeAttributesClassName" => Field::Key_current_volume_attributes_class_name, + "modifyVolumeStatus" => Field::Key_modify_volume_status, + "phase" => Field::Key_phase, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaimStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeClaimStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_access_modes: Option> = None; + let mut value_allocated_resource_statuses: Option> = None; + let mut value_allocated_resources: Option> = None; + let mut value_capacity: Option> = None; + let mut value_conditions: Option> = None; + let mut value_current_volume_attributes_class_name: Option = None; + let mut value_modify_volume_status: Option = None; + let mut value_phase: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_access_modes => value_access_modes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_allocated_resource_statuses => value_allocated_resource_statuses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_allocated_resources => value_allocated_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_volume_attributes_class_name => value_current_volume_attributes_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_modify_volume_status => value_modify_volume_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaimStatus { + access_modes: value_access_modes, + allocated_resource_statuses: value_allocated_resource_statuses, + allocated_resources: value_allocated_resources, + capacity: value_capacity, + conditions: value_conditions, + current_volume_attributes_class_name: value_current_volume_attributes_class_name, + modify_volume_status: value_modify_volume_status, + phase: value_phase, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimStatus", + &[ + "accessModes", + "allocatedResourceStatuses", + "allocatedResources", + "capacity", + "conditions", + "currentVolumeAttributesClassName", + "modifyVolumeStatus", + "phase", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaimStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeClaimStatus", + self.access_modes.as_ref().map_or(0, |_| 1) + + self.allocated_resource_statuses.as_ref().map_or(0, |_| 1) + + self.allocated_resources.as_ref().map_or(0, |_| 1) + + self.capacity.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.current_volume_attributes_class_name.as_ref().map_or(0, |_| 1) + + self.modify_volume_status.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.access_modes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "accessModes", value)?; + } + if let Some(value) = &self.allocated_resource_statuses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocatedResourceStatuses", value)?; + } + if let Some(value) = &self.allocated_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocatedResources", value)?; + } + if let Some(value) = &self.capacity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.current_volume_attributes_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentVolumeAttributesClassName", value)?; + } + if let Some(value) = &self.modify_volume_status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "modifyVolumeStatus", value)?; + } + if let Some(value) = &self.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaimStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaimStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaimStatus is the current status of a persistent volume claim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "accessModes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("accessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "allocatedResourceStatuses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allocatedResourceStatuses stores status of resource being resized for the given PVC. Key names follow standard Kubernetes label syntax. Valid values are either:\n\t* Un-prefixed keys:\n\t\t- storage - the capacity of the volume.\n\t* Custom resources must use implementation-defined prefixed names such as \"example.com/my-custom-resource\"\nApart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used.\n\nClaimResourceStatus can be in any of following states:\n\t- ControllerResizeInProgress:\n\t\tState set when resize controller starts resizing the volume in control-plane.\n\t- ControllerResizeFailed:\n\t\tState set when resize has failed in resize controller with a terminal error.\n\t- NodeResizePending:\n\t\tState set when resize controller has finished resizing the volume but further resizing of\n\t\tvolume is needed on the node.\n\t- NodeResizeInProgress:\n\t\tState set when kubelet starts resizing the volume.\n\t- NodeResizeFailed:\n\t\tState set when resizing has failed in kubelet with a terminal error. Transient errors don't set\n\t\tNodeResizeFailed.\nFor example: if expanding a PVC for more capacity - this field can be one of the following states:\n\t- pvc.status.allocatedResourceStatus['storage'] = \"ControllerResizeInProgress\"\n - pvc.status.allocatedResourceStatus['storage'] = \"ControllerResizeFailed\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizePending\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizeInProgress\"\n - pvc.status.allocatedResourceStatus['storage'] = \"NodeResizeFailed\"\nWhen this field is not set, it means that no resize operation is in progress for the given PVC.\n\nA controller that receives PVC update with previously unknown resourceName or ClaimResourceStatus should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC.\n\nThis is an alpha field and requires enabling RecoverVolumeExpansionFailure feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "allocatedResources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allocatedResources tracks the resources allocated to a PVC including its capacity. Key names follow standard Kubernetes label syntax. Valid values are either:\n\t* Un-prefixed keys:\n\t\t- storage - the capacity of the volume.\n\t* Custom resources must use implementation-defined prefixed names such as \"example.com/my-custom-resource\"\nApart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used.\n\nCapacity reported here may be larger than the actual capacity when a volume expansion operation is requested. For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. If allocatedResources is not set, PVC.spec.resources alone is used for quota calculation. If a volume expansion capacity request is lowered, allocatedResources is only lowered if there are no expansion operations in progress and if the actual volume capacity is equal or lower than the requested capacity.\n\nA controller that receives PVC update with previously unknown resourceName should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC.\n\nThis is an alpha field and requires enabling RecoverVolumeExpansionFailure feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "capacity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("capacity represents the actual resources of the underlying volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'Resizing'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentVolumeAttributesClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim This is an alpha field and requires enabling VolumeAttributesClass feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "modifyVolumeStatus".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. This is an alpha field and requires enabling VolumeAttributesClass feature.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "phase".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("phase represents the current phase of PersistentVolumeClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim_template.rs b/src/v1_30/api/core/v1/persistent_volume_claim_template.rs new file mode 100644 index 000000000..ea6af7233 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim_template.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimTemplate + +/// PersistentVolumeClaimTemplate is used to produce PersistentVolumeClaim objects as part of an EphemeralVolumeSource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaimTemplate { + /// May contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation. + pub metadata: Option, + + /// The specification for the PersistentVolumeClaim. The entire content is copied unchanged into the PVC that gets created from this template. The same fields as in a PersistentVolumeClaim are also valid here. + pub spec: crate::api::core::v1::PersistentVolumeClaimSpec, +} + +impl crate::DeepMerge for PersistentVolumeClaimTemplate { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaimTemplate { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaimTemplate; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeClaimTemplate") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaimTemplate { + metadata: value_metadata, + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimTemplate", + &[ + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaimTemplate { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeClaimTemplate", + 1 + + self.metadata.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.metadata { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaimTemplate { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaimTemplate".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaimTemplate is used to produce PersistentVolumeClaim objects as part of an EphemeralVolumeSource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("May contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The specification for the PersistentVolumeClaim. The entire content is copied unchanged into the PVC that gets created from this template. The same fields as in a PersistentVolumeClaim are also valid here.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_claim_volume_source.rs b/src/v1_30/api/core/v1/persistent_volume_claim_volume_source.rs new file mode 100644 index 000000000..a80c2ee70 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_claim_volume_source.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimVolumeSource + +/// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeClaimVolumeSource { + /// claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + pub claim_name: String, + + /// readOnly Will force the ReadOnly setting in VolumeMounts. Default false. + pub read_only: Option, +} + +impl crate::DeepMerge for PersistentVolumeClaimVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.claim_name, other.claim_name); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeClaimVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_claim_name, + Key_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "claimName" => Field::Key_claim_name, + "readOnly" => Field::Key_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeClaimVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeClaimVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_claim_name: Option = None; + let mut value_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_claim_name => value_claim_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeClaimVolumeSource { + claim_name: value_claim_name.unwrap_or_default(), + read_only: value_read_only, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeClaimVolumeSource", + &[ + "claimName", + "readOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeClaimVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeClaimVolumeSource", + 1 + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "claimName", &self.claim_name)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeClaimVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeClaimVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "claimName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly Will force the ReadOnly setting in VolumeMounts. Default false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "claimName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_spec.rs b/src/v1_30/api/core/v1/persistent_volume_spec.rs new file mode 100644 index 000000000..a1aecc5f4 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_spec.rs @@ -0,0 +1,901 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeSpec + +/// PersistentVolumeSpec is the specification of a persistent volume. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeSpec { + /// accessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes + pub access_modes: Option>, + + /// awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + pub aws_elastic_block_store: Option, + + /// azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + pub azure_disk: Option, + + /// azureFile represents an Azure File Service mount on the host and bind mount to the pod. + pub azure_file: Option, + + /// capacity is the description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity + pub capacity: Option>, + + /// cephFS represents a Ceph FS mount on the host that shares a pod's lifetime + pub cephfs: Option, + + /// cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub cinder: Option, + + /// claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding + pub claim_ref: Option, + + /// csi represents storage that is handled by an external CSI driver (Beta feature). + pub csi: Option, + + /// fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + pub fc: Option, + + /// flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. + pub flex_volume: Option, + + /// flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running + pub flocker: Option, + + /// gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub gce_persistent_disk: Option, + + /// glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: https://examples.k8s.io/volumes/glusterfs/README.md + pub glusterfs: Option, + + /// hostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + pub host_path: Option, + + /// iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. + pub iscsi: Option, + + /// local represents directly-attached storage with node affinity + pub local: Option, + + /// mountOptions is the list of mount options, e.g. \["ro", "soft"\]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options + pub mount_options: Option>, + + /// nfs represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + pub nfs: Option, + + /// nodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume. + pub node_affinity: Option, + + /// persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming + pub persistent_volume_reclaim_policy: Option, + + /// photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine + pub photon_persistent_disk: Option, + + /// portworxVolume represents a portworx volume attached and mounted on kubelets host machine + pub portworx_volume: Option, + + /// quobyte represents a Quobyte mount on the host that shares a pod's lifetime + pub quobyte: Option, + + /// rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md + pub rbd: Option, + + /// scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + pub scale_io: Option, + + /// storageClassName is the name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass. + pub storage_class_name: Option, + + /// storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://examples.k8s.io/volumes/storageos/README.md + pub storageos: Option, + + /// Name of VolumeAttributesClass to which this persistent volume belongs. Empty value is not allowed. When this field is not set, it indicates that this volume does not belong to any VolumeAttributesClass. This field is mutable and can be changed by the CSI driver after a volume has been updated successfully to a new class. For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound PersistentVolumeClaims during the binding process. This is an alpha field and requires enabling VolumeAttributesClass feature. + pub volume_attributes_class_name: Option, + + /// volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec. + pub volume_mode: Option, + + /// vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine + pub vsphere_volume: Option, +} + +impl crate::DeepMerge for PersistentVolumeSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.access_modes, other.access_modes); + crate::DeepMerge::merge_from(&mut self.aws_elastic_block_store, other.aws_elastic_block_store); + crate::DeepMerge::merge_from(&mut self.azure_disk, other.azure_disk); + crate::DeepMerge::merge_from(&mut self.azure_file, other.azure_file); + crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.cephfs, other.cephfs); + crate::DeepMerge::merge_from(&mut self.cinder, other.cinder); + crate::DeepMerge::merge_from(&mut self.claim_ref, other.claim_ref); + crate::DeepMerge::merge_from(&mut self.csi, other.csi); + crate::DeepMerge::merge_from(&mut self.fc, other.fc); + crate::DeepMerge::merge_from(&mut self.flex_volume, other.flex_volume); + crate::DeepMerge::merge_from(&mut self.flocker, other.flocker); + crate::DeepMerge::merge_from(&mut self.gce_persistent_disk, other.gce_persistent_disk); + crate::DeepMerge::merge_from(&mut self.glusterfs, other.glusterfs); + crate::DeepMerge::merge_from(&mut self.host_path, other.host_path); + crate::DeepMerge::merge_from(&mut self.iscsi, other.iscsi); + crate::DeepMerge::merge_from(&mut self.local, other.local); + crate::merge_strategies::list::atomic(&mut self.mount_options, other.mount_options); + crate::DeepMerge::merge_from(&mut self.nfs, other.nfs); + crate::DeepMerge::merge_from(&mut self.node_affinity, other.node_affinity); + crate::DeepMerge::merge_from(&mut self.persistent_volume_reclaim_policy, other.persistent_volume_reclaim_policy); + crate::DeepMerge::merge_from(&mut self.photon_persistent_disk, other.photon_persistent_disk); + crate::DeepMerge::merge_from(&mut self.portworx_volume, other.portworx_volume); + crate::DeepMerge::merge_from(&mut self.quobyte, other.quobyte); + crate::DeepMerge::merge_from(&mut self.rbd, other.rbd); + crate::DeepMerge::merge_from(&mut self.scale_io, other.scale_io); + crate::DeepMerge::merge_from(&mut self.storage_class_name, other.storage_class_name); + crate::DeepMerge::merge_from(&mut self.storageos, other.storageos); + crate::DeepMerge::merge_from(&mut self.volume_attributes_class_name, other.volume_attributes_class_name); + crate::DeepMerge::merge_from(&mut self.volume_mode, other.volume_mode); + crate::DeepMerge::merge_from(&mut self.vsphere_volume, other.vsphere_volume); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_access_modes, + Key_aws_elastic_block_store, + Key_azure_disk, + Key_azure_file, + Key_capacity, + Key_cephfs, + Key_cinder, + Key_claim_ref, + Key_csi, + Key_fc, + Key_flex_volume, + Key_flocker, + Key_gce_persistent_disk, + Key_glusterfs, + Key_host_path, + Key_iscsi, + Key_local, + Key_mount_options, + Key_nfs, + Key_node_affinity, + Key_persistent_volume_reclaim_policy, + Key_photon_persistent_disk, + Key_portworx_volume, + Key_quobyte, + Key_rbd, + Key_scale_io, + Key_storage_class_name, + Key_storageos, + Key_volume_attributes_class_name, + Key_volume_mode, + Key_vsphere_volume, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "accessModes" => Field::Key_access_modes, + "awsElasticBlockStore" => Field::Key_aws_elastic_block_store, + "azureDisk" => Field::Key_azure_disk, + "azureFile" => Field::Key_azure_file, + "capacity" => Field::Key_capacity, + "cephfs" => Field::Key_cephfs, + "cinder" => Field::Key_cinder, + "claimRef" => Field::Key_claim_ref, + "csi" => Field::Key_csi, + "fc" => Field::Key_fc, + "flexVolume" => Field::Key_flex_volume, + "flocker" => Field::Key_flocker, + "gcePersistentDisk" => Field::Key_gce_persistent_disk, + "glusterfs" => Field::Key_glusterfs, + "hostPath" => Field::Key_host_path, + "iscsi" => Field::Key_iscsi, + "local" => Field::Key_local, + "mountOptions" => Field::Key_mount_options, + "nfs" => Field::Key_nfs, + "nodeAffinity" => Field::Key_node_affinity, + "persistentVolumeReclaimPolicy" => Field::Key_persistent_volume_reclaim_policy, + "photonPersistentDisk" => Field::Key_photon_persistent_disk, + "portworxVolume" => Field::Key_portworx_volume, + "quobyte" => Field::Key_quobyte, + "rbd" => Field::Key_rbd, + "scaleIO" => Field::Key_scale_io, + "storageClassName" => Field::Key_storage_class_name, + "storageos" => Field::Key_storageos, + "volumeAttributesClassName" => Field::Key_volume_attributes_class_name, + "volumeMode" => Field::Key_volume_mode, + "vsphereVolume" => Field::Key_vsphere_volume, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_access_modes: Option> = None; + let mut value_aws_elastic_block_store: Option = None; + let mut value_azure_disk: Option = None; + let mut value_azure_file: Option = None; + let mut value_capacity: Option> = None; + let mut value_cephfs: Option = None; + let mut value_cinder: Option = None; + let mut value_claim_ref: Option = None; + let mut value_csi: Option = None; + let mut value_fc: Option = None; + let mut value_flex_volume: Option = None; + let mut value_flocker: Option = None; + let mut value_gce_persistent_disk: Option = None; + let mut value_glusterfs: Option = None; + let mut value_host_path: Option = None; + let mut value_iscsi: Option = None; + let mut value_local: Option = None; + let mut value_mount_options: Option> = None; + let mut value_nfs: Option = None; + let mut value_node_affinity: Option = None; + let mut value_persistent_volume_reclaim_policy: Option = None; + let mut value_photon_persistent_disk: Option = None; + let mut value_portworx_volume: Option = None; + let mut value_quobyte: Option = None; + let mut value_rbd: Option = None; + let mut value_scale_io: Option = None; + let mut value_storage_class_name: Option = None; + let mut value_storageos: Option = None; + let mut value_volume_attributes_class_name: Option = None; + let mut value_volume_mode: Option = None; + let mut value_vsphere_volume: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_access_modes => value_access_modes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_aws_elastic_block_store => value_aws_elastic_block_store = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_azure_disk => value_azure_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_azure_file => value_azure_file = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cephfs => value_cephfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cinder => value_cinder = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_claim_ref => value_claim_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_csi => value_csi = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fc => value_fc = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_flex_volume => value_flex_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_flocker => value_flocker = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_gce_persistent_disk => value_gce_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_glusterfs => value_glusterfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_path => value_host_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iscsi => value_iscsi = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_local => value_local = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mount_options => value_mount_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nfs => value_nfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_affinity => value_node_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_persistent_volume_reclaim_policy => value_persistent_volume_reclaim_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_photon_persistent_disk => value_photon_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_portworx_volume => value_portworx_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_quobyte => value_quobyte = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rbd => value_rbd = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scale_io => value_scale_io = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_class_name => value_storage_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storageos => value_storageos = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_attributes_class_name => value_volume_attributes_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_mode => value_volume_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vsphere_volume => value_vsphere_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeSpec { + access_modes: value_access_modes, + aws_elastic_block_store: value_aws_elastic_block_store, + azure_disk: value_azure_disk, + azure_file: value_azure_file, + capacity: value_capacity, + cephfs: value_cephfs, + cinder: value_cinder, + claim_ref: value_claim_ref, + csi: value_csi, + fc: value_fc, + flex_volume: value_flex_volume, + flocker: value_flocker, + gce_persistent_disk: value_gce_persistent_disk, + glusterfs: value_glusterfs, + host_path: value_host_path, + iscsi: value_iscsi, + local: value_local, + mount_options: value_mount_options, + nfs: value_nfs, + node_affinity: value_node_affinity, + persistent_volume_reclaim_policy: value_persistent_volume_reclaim_policy, + photon_persistent_disk: value_photon_persistent_disk, + portworx_volume: value_portworx_volume, + quobyte: value_quobyte, + rbd: value_rbd, + scale_io: value_scale_io, + storage_class_name: value_storage_class_name, + storageos: value_storageos, + volume_attributes_class_name: value_volume_attributes_class_name, + volume_mode: value_volume_mode, + vsphere_volume: value_vsphere_volume, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeSpec", + &[ + "accessModes", + "awsElasticBlockStore", + "azureDisk", + "azureFile", + "capacity", + "cephfs", + "cinder", + "claimRef", + "csi", + "fc", + "flexVolume", + "flocker", + "gcePersistentDisk", + "glusterfs", + "hostPath", + "iscsi", + "local", + "mountOptions", + "nfs", + "nodeAffinity", + "persistentVolumeReclaimPolicy", + "photonPersistentDisk", + "portworxVolume", + "quobyte", + "rbd", + "scaleIO", + "storageClassName", + "storageos", + "volumeAttributesClassName", + "volumeMode", + "vsphereVolume", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeSpec", + self.access_modes.as_ref().map_or(0, |_| 1) + + self.aws_elastic_block_store.as_ref().map_or(0, |_| 1) + + self.azure_disk.as_ref().map_or(0, |_| 1) + + self.azure_file.as_ref().map_or(0, |_| 1) + + self.capacity.as_ref().map_or(0, |_| 1) + + self.cephfs.as_ref().map_or(0, |_| 1) + + self.cinder.as_ref().map_or(0, |_| 1) + + self.claim_ref.as_ref().map_or(0, |_| 1) + + self.csi.as_ref().map_or(0, |_| 1) + + self.fc.as_ref().map_or(0, |_| 1) + + self.flex_volume.as_ref().map_or(0, |_| 1) + + self.flocker.as_ref().map_or(0, |_| 1) + + self.gce_persistent_disk.as_ref().map_or(0, |_| 1) + + self.glusterfs.as_ref().map_or(0, |_| 1) + + self.host_path.as_ref().map_or(0, |_| 1) + + self.iscsi.as_ref().map_or(0, |_| 1) + + self.local.as_ref().map_or(0, |_| 1) + + self.mount_options.as_ref().map_or(0, |_| 1) + + self.nfs.as_ref().map_or(0, |_| 1) + + self.node_affinity.as_ref().map_or(0, |_| 1) + + self.persistent_volume_reclaim_policy.as_ref().map_or(0, |_| 1) + + self.photon_persistent_disk.as_ref().map_or(0, |_| 1) + + self.portworx_volume.as_ref().map_or(0, |_| 1) + + self.quobyte.as_ref().map_or(0, |_| 1) + + self.rbd.as_ref().map_or(0, |_| 1) + + self.scale_io.as_ref().map_or(0, |_| 1) + + self.storage_class_name.as_ref().map_or(0, |_| 1) + + self.storageos.as_ref().map_or(0, |_| 1) + + self.volume_attributes_class_name.as_ref().map_or(0, |_| 1) + + self.volume_mode.as_ref().map_or(0, |_| 1) + + self.vsphere_volume.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.access_modes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "accessModes", value)?; + } + if let Some(value) = &self.aws_elastic_block_store { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "awsElasticBlockStore", value)?; + } + if let Some(value) = &self.azure_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureDisk", value)?; + } + if let Some(value) = &self.azure_file { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureFile", value)?; + } + if let Some(value) = &self.capacity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?; + } + if let Some(value) = &self.cephfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cephfs", value)?; + } + if let Some(value) = &self.cinder { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cinder", value)?; + } + if let Some(value) = &self.claim_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "claimRef", value)?; + } + if let Some(value) = &self.csi { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "csi", value)?; + } + if let Some(value) = &self.fc { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fc", value)?; + } + if let Some(value) = &self.flex_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flexVolume", value)?; + } + if let Some(value) = &self.flocker { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flocker", value)?; + } + if let Some(value) = &self.gce_persistent_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gcePersistentDisk", value)?; + } + if let Some(value) = &self.glusterfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "glusterfs", value)?; + } + if let Some(value) = &self.host_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPath", value)?; + } + if let Some(value) = &self.iscsi { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsi", value)?; + } + if let Some(value) = &self.local { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "local", value)?; + } + if let Some(value) = &self.mount_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountOptions", value)?; + } + if let Some(value) = &self.nfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nfs", value)?; + } + if let Some(value) = &self.node_affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAffinity", value)?; + } + if let Some(value) = &self.persistent_volume_reclaim_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeReclaimPolicy", value)?; + } + if let Some(value) = &self.photon_persistent_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "photonPersistentDisk", value)?; + } + if let Some(value) = &self.portworx_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portworxVolume", value)?; + } + if let Some(value) = &self.quobyte { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quobyte", value)?; + } + if let Some(value) = &self.rbd { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rbd", value)?; + } + if let Some(value) = &self.scale_io { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleIO", value)?; + } + if let Some(value) = &self.storage_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageClassName", value)?; + } + if let Some(value) = &self.storageos { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageos", value)?; + } + if let Some(value) = &self.volume_attributes_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeAttributesClassName", value)?; + } + if let Some(value) = &self.volume_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMode", value)?; + } + if let Some(value) = &self.vsphere_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vsphereVolume", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeSpec is the specification of a persistent volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "accessModes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("accessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "awsElasticBlockStore".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "azureDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "azureFile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("azureFile represents an Azure File Service mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "capacity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("capacity is the description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "cephfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cephFS represents a Ceph FS mount on the host that shares a pod's lifetime".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "cinder".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "claimRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "csi".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("csi represents storage that is handled by an external CSI driver (Beta feature).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "fc".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "flexVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "flocker".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "gcePersistentDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "glusterfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: https://examples.k8s.io/volumes/glusterfs/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "hostPath".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "iscsi".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "local".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("local represents directly-attached storage with node affinity".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "mountOptions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("mountOptions is the list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "nfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nfs represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nodeAffinity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "persistentVolumeReclaimPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "photonPersistentDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "portworxVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("portworxVolume represents a portworx volume attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "quobyte".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("quobyte represents a Quobyte mount on the host that shares a pod's lifetime".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rbd".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scaleIO".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "storageClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageClassName is the name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storageos".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://examples.k8s.io/volumes/storageos/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeAttributesClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of VolumeAttributesClass to which this persistent volume belongs. Empty value is not allowed. When this field is not set, it indicates that this volume does not belong to any VolumeAttributesClass. This field is mutable and can be changed by the CSI driver after a volume has been updated successfully to a new class. For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound PersistentVolumeClaims during the binding process. This is an alpha field and requires enabling VolumeAttributesClass feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "vsphereVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/persistent_volume_status.rs b/src/v1_30/api/core/v1/persistent_volume_status.rs new file mode 100644 index 000000000..69e145976 --- /dev/null +++ b/src/v1_30/api/core/v1/persistent_volume_status.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.PersistentVolumeStatus + +/// PersistentVolumeStatus is the current status of a persistent volume. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PersistentVolumeStatus { + /// lastPhaseTransitionTime is the time the phase transitioned from one to another and automatically resets to current time everytime a volume phase transitions. This is a beta field and requires the PersistentVolumeLastPhaseTransitionTime feature to be enabled (enabled by default). + pub last_phase_transition_time: Option, + + /// message is a human-readable message indicating details about why the volume is in this state. + pub message: Option, + + /// phase indicates if a volume is available, bound to a claim, or released by a claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase + pub phase: Option, + + /// reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI. + pub reason: Option, +} + +impl crate::DeepMerge for PersistentVolumeStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_phase_transition_time, other.last_phase_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_phase_transition_time, + Key_message, + Key_phase, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastPhaseTransitionTime" => Field::Key_last_phase_transition_time, + "message" => Field::Key_message, + "phase" => Field::Key_phase, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PersistentVolumeStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PersistentVolumeStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_phase_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_phase: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_phase_transition_time => value_last_phase_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PersistentVolumeStatus { + last_phase_transition_time: value_last_phase_transition_time, + message: value_message, + phase: value_phase, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "PersistentVolumeStatus", + &[ + "lastPhaseTransitionTime", + "message", + "phase", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PersistentVolumeStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PersistentVolumeStatus", + self.last_phase_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_phase_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastPhaseTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PersistentVolumeStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.PersistentVolumeStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PersistentVolumeStatus is the current status of a persistent volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastPhaseTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastPhaseTransitionTime is the time the phase transitioned from one to another and automatically resets to current time everytime a volume phase transitions. This is a beta field and requires the PersistentVolumeLastPhaseTransitionTime feature to be enabled (enabled by default).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message is a human-readable message indicating details about why the volume is in this state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "phase".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("phase indicates if a volume is available, bound to a claim, or released by a claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/photon_persistent_disk_volume_source.rs b/src/v1_30/api/core/v1/photon_persistent_disk_volume_source.rs new file mode 100644 index 000000000..3fbf3e576 --- /dev/null +++ b/src/v1_30/api/core/v1/photon_persistent_disk_volume_source.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.PhotonPersistentDiskVolumeSource + +/// Represents a Photon Controller persistent disk resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PhotonPersistentDiskVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// pdID is the ID that identifies Photon Controller persistent disk + pub pd_id: String, +} + +impl crate::DeepMerge for PhotonPersistentDiskVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.pd_id, other.pd_id); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PhotonPersistentDiskVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_pd_id, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "pdID" => Field::Key_pd_id, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PhotonPersistentDiskVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PhotonPersistentDiskVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_pd_id: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pd_id => value_pd_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PhotonPersistentDiskVolumeSource { + fs_type: value_fs_type, + pd_id: value_pd_id.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PhotonPersistentDiskVolumeSource", + &[ + "fsType", + "pdID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PhotonPersistentDiskVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PhotonPersistentDiskVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pdID", &self.pd_id)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PhotonPersistentDiskVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.PhotonPersistentDiskVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Photon Controller persistent disk resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "pdID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pdID is the ID that identifies Photon Controller persistent disk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "pdID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod.rs b/src/v1_30/api/core/v1/pod.rs new file mode 100644 index 000000000..803af6a12 --- /dev/null +++ b/src/v1_30/api/core/v1/pod.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.Pod + +/// Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Pod { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Pod { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Pod"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "pods"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Pod { + const LIST_KIND: &'static str = "PodList"; +} + +impl crate::Metadata for Pod { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Pod { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Pod { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Pod; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Pod { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Pod { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Pod { + fn schema_name() -> String { + "io.k8s.api.core.v1.Pod".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_affinity.rs b/src/v1_30/api/core/v1/pod_affinity.rs new file mode 100644 index 000000000..a528250bb --- /dev/null +++ b/src/v1_30/api/core/v1/pod_affinity.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.core.v1.PodAffinity + +/// Pod affinity is a group of inter pod affinity scheduling rules. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodAffinity { + /// The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + pub preferred_during_scheduling_ignored_during_execution: Option>, + + /// If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + pub required_during_scheduling_ignored_during_execution: Option>, +} + +impl crate::DeepMerge for PodAffinity { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.preferred_during_scheduling_ignored_during_execution, other.preferred_during_scheduling_ignored_during_execution); + crate::merge_strategies::list::atomic(&mut self.required_during_scheduling_ignored_during_execution, other.required_during_scheduling_ignored_during_execution); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodAffinity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_preferred_during_scheduling_ignored_during_execution, + Key_required_during_scheduling_ignored_during_execution, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "preferredDuringSchedulingIgnoredDuringExecution" => Field::Key_preferred_during_scheduling_ignored_during_execution, + "requiredDuringSchedulingIgnoredDuringExecution" => Field::Key_required_during_scheduling_ignored_during_execution, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodAffinity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodAffinity") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_preferred_during_scheduling_ignored_during_execution: Option> = None; + let mut value_required_during_scheduling_ignored_during_execution: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_preferred_during_scheduling_ignored_during_execution => value_preferred_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_required_during_scheduling_ignored_during_execution => value_required_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodAffinity { + preferred_during_scheduling_ignored_during_execution: value_preferred_during_scheduling_ignored_during_execution, + required_during_scheduling_ignored_during_execution: value_required_during_scheduling_ignored_during_execution, + }) + } + } + + deserializer.deserialize_struct( + "PodAffinity", + &[ + "preferredDuringSchedulingIgnoredDuringExecution", + "requiredDuringSchedulingIgnoredDuringExecution", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodAffinity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodAffinity", + self.preferred_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1) + + self.required_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.preferred_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preferredDuringSchedulingIgnoredDuringExecution", value)?; + } + if let Some(value) = &self.required_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requiredDuringSchedulingIgnoredDuringExecution", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodAffinity { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodAffinity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Pod affinity is a group of inter pod affinity scheduling rules.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "preferredDuringSchedulingIgnoredDuringExecution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "requiredDuringSchedulingIgnoredDuringExecution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_affinity_term.rs b/src/v1_30/api/core/v1/pod_affinity_term.rs new file mode 100644 index 000000000..d31842778 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_affinity_term.rs @@ -0,0 +1,280 @@ +// Generated from definition io.k8s.api.core.v1.PodAffinityTerm + +/// Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \ matches that of any node on which a pod of the set of pods is running +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodAffinityTerm { + /// A label query over a set of resources, in this case pods. If it's null, this PodAffinityTerm matches with no Pods. + pub label_selector: Option, + + /// MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + pub match_label_keys: Option>, + + /// MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate. + pub mismatch_label_keys: Option>, + + /// A label query over the set of namespaces that the term applies to. The term is applied to the union of the namespaces selected by this field and the ones listed in the namespaces field. null selector and null or empty namespaces list means "this pod's namespace". An empty selector ({}) matches all namespaces. + pub namespace_selector: Option, + + /// namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means "this pod's namespace". + pub namespaces: Option>, + + /// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. + pub topology_key: String, +} + +impl crate::DeepMerge for PodAffinityTerm { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.label_selector, other.label_selector); + crate::merge_strategies::list::atomic(&mut self.match_label_keys, other.match_label_keys); + crate::merge_strategies::list::atomic(&mut self.mismatch_label_keys, other.mismatch_label_keys); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::merge_strategies::list::atomic(&mut self.namespaces, other.namespaces); + crate::DeepMerge::merge_from(&mut self.topology_key, other.topology_key); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodAffinityTerm { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_label_selector, + Key_match_label_keys, + Key_mismatch_label_keys, + Key_namespace_selector, + Key_namespaces, + Key_topology_key, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "labelSelector" => Field::Key_label_selector, + "matchLabelKeys" => Field::Key_match_label_keys, + "mismatchLabelKeys" => Field::Key_mismatch_label_keys, + "namespaceSelector" => Field::Key_namespace_selector, + "namespaces" => Field::Key_namespaces, + "topologyKey" => Field::Key_topology_key, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodAffinityTerm; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodAffinityTerm") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_label_selector: Option = None; + let mut value_match_label_keys: Option> = None; + let mut value_mismatch_label_keys: Option> = None; + let mut value_namespace_selector: Option = None; + let mut value_namespaces: Option> = None; + let mut value_topology_key: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_label_selector => value_label_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_label_keys => value_match_label_keys = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mismatch_label_keys => value_mismatch_label_keys = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespaces => value_namespaces = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_topology_key => value_topology_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodAffinityTerm { + label_selector: value_label_selector, + match_label_keys: value_match_label_keys, + mismatch_label_keys: value_mismatch_label_keys, + namespace_selector: value_namespace_selector, + namespaces: value_namespaces, + topology_key: value_topology_key.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodAffinityTerm", + &[ + "labelSelector", + "matchLabelKeys", + "mismatchLabelKeys", + "namespaceSelector", + "namespaces", + "topologyKey", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodAffinityTerm { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodAffinityTerm", + 1 + + self.label_selector.as_ref().map_or(0, |_| 1) + + self.match_label_keys.as_ref().map_or(0, |_| 1) + + self.mismatch_label_keys.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.namespaces.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.label_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "labelSelector", value)?; + } + if let Some(value) = &self.match_label_keys { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchLabelKeys", value)?; + } + if let Some(value) = &self.mismatch_label_keys { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mismatchLabelKeys", value)?; + } + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.namespaces { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaces", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "topologyKey", &self.topology_key)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodAffinityTerm { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodAffinityTerm".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "labelSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label query over a set of resources, in this case pods. If it's null, this PodAffinityTerm matches with no Pods.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "matchLabelKeys".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "mismatchLabelKeys".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label query over the set of namespaces that the term applies to. The term is applied to the union of the namespaces selected by this field and the ones listed in the namespaces field. null selector and null or empty namespaces list means \"this pod's namespace\". An empty selector ({}) matches all namespaces.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "namespaces".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means \"this pod's namespace\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "topologyKey".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "topologyKey".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_anti_affinity.rs b/src/v1_30/api/core/v1/pod_anti_affinity.rs new file mode 100644 index 000000000..86979017a --- /dev/null +++ b/src/v1_30/api/core/v1/pod_anti_affinity.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.core.v1.PodAntiAffinity + +/// Pod anti affinity is a group of inter pod anti affinity scheduling rules. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodAntiAffinity { + /// The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + pub preferred_during_scheduling_ignored_during_execution: Option>, + + /// If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + pub required_during_scheduling_ignored_during_execution: Option>, +} + +impl crate::DeepMerge for PodAntiAffinity { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.preferred_during_scheduling_ignored_during_execution, other.preferred_during_scheduling_ignored_during_execution); + crate::merge_strategies::list::atomic(&mut self.required_during_scheduling_ignored_during_execution, other.required_during_scheduling_ignored_during_execution); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodAntiAffinity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_preferred_during_scheduling_ignored_during_execution, + Key_required_during_scheduling_ignored_during_execution, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "preferredDuringSchedulingIgnoredDuringExecution" => Field::Key_preferred_during_scheduling_ignored_during_execution, + "requiredDuringSchedulingIgnoredDuringExecution" => Field::Key_required_during_scheduling_ignored_during_execution, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodAntiAffinity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodAntiAffinity") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_preferred_during_scheduling_ignored_during_execution: Option> = None; + let mut value_required_during_scheduling_ignored_during_execution: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_preferred_during_scheduling_ignored_during_execution => value_preferred_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_required_during_scheduling_ignored_during_execution => value_required_during_scheduling_ignored_during_execution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodAntiAffinity { + preferred_during_scheduling_ignored_during_execution: value_preferred_during_scheduling_ignored_during_execution, + required_during_scheduling_ignored_during_execution: value_required_during_scheduling_ignored_during_execution, + }) + } + } + + deserializer.deserialize_struct( + "PodAntiAffinity", + &[ + "preferredDuringSchedulingIgnoredDuringExecution", + "requiredDuringSchedulingIgnoredDuringExecution", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodAntiAffinity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodAntiAffinity", + self.preferred_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1) + + self.required_during_scheduling_ignored_during_execution.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.preferred_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preferredDuringSchedulingIgnoredDuringExecution", value)?; + } + if let Some(value) = &self.required_during_scheduling_ignored_during_execution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requiredDuringSchedulingIgnoredDuringExecution", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodAntiAffinity { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodAntiAffinity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Pod anti affinity is a group of inter pod anti affinity scheduling rules.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "preferredDuringSchedulingIgnoredDuringExecution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "requiredDuringSchedulingIgnoredDuringExecution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_condition.rs b/src/v1_30/api/core/v1/pod_condition.rs new file mode 100644 index 000000000..7b78db671 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_condition.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.core.v1.PodCondition + +/// PodCondition contains details for the current condition of this pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodCondition { + /// Last time we probed the condition. + pub last_probe_time: Option, + + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// Human-readable message indicating details about last transition. + pub message: Option, + + /// Unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + pub status: String, + + /// Type is the type of the condition. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + pub type_: String, +} + +impl crate::DeepMerge for PodCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_probe_time, other.last_probe_time); + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_probe_time, + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastProbeTime" => Field::Key_last_probe_time, + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_probe_time: Option = None; + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_probe_time => value_last_probe_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodCondition { + last_probe_time: value_last_probe_time, + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodCondition", + &[ + "lastProbeTime", + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodCondition", + 2 + + self.last_probe_time.as_ref().map_or(0, |_| 1) + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_probe_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastProbeTime", value)?; + } + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodCondition contains details for the current condition of this pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastProbeTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time we probed the condition.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type is the type of the condition. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_dns_config.rs b/src/v1_30/api/core/v1/pod_dns_config.rs new file mode 100644 index 000000000..201eb4d69 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_dns_config.rs @@ -0,0 +1,199 @@ +// Generated from definition io.k8s.api.core.v1.PodDNSConfig + +/// PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodDNSConfig { + /// A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed. + pub nameservers: Option>, + + /// A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy. + pub options: Option>, + + /// A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed. + pub searches: Option>, +} + +impl crate::DeepMerge for PodDNSConfig { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.nameservers, other.nameservers); + crate::merge_strategies::list::atomic(&mut self.options, other.options); + crate::merge_strategies::list::atomic(&mut self.searches, other.searches); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodDNSConfig { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_nameservers, + Key_options, + Key_searches, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nameservers" => Field::Key_nameservers, + "options" => Field::Key_options, + "searches" => Field::Key_searches, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodDNSConfig; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodDNSConfig") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_nameservers: Option> = None; + let mut value_options: Option> = None; + let mut value_searches: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_nameservers => value_nameservers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_options => value_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_searches => value_searches = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodDNSConfig { + nameservers: value_nameservers, + options: value_options, + searches: value_searches, + }) + } + } + + deserializer.deserialize_struct( + "PodDNSConfig", + &[ + "nameservers", + "options", + "searches", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodDNSConfig { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodDNSConfig", + self.nameservers.as_ref().map_or(0, |_| 1) + + self.options.as_ref().map_or(0, |_| 1) + + self.searches.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.nameservers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nameservers", value)?; + } + if let Some(value) = &self.options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "options", value)?; + } + if let Some(value) = &self.searches { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "searches", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodDNSConfig { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodDNSConfig".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nameservers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "options".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "searches".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_dns_config_option.rs b/src/v1_30/api/core/v1/pod_dns_config_option.rs new file mode 100644 index 000000000..86bd37450 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_dns_config_option.rs @@ -0,0 +1,147 @@ +// Generated from definition io.k8s.api.core.v1.PodDNSConfigOption + +/// PodDNSConfigOption defines DNS resolver options of a pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodDNSConfigOption { + /// Required. + pub name: Option, + + pub value: Option, +} + +impl crate::DeepMerge for PodDNSConfigOption { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodDNSConfigOption { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodDNSConfigOption; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodDNSConfigOption") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodDNSConfigOption { + name: value_name, + value: value_value, + }) + } + } + + deserializer.deserialize_struct( + "PodDNSConfigOption", + &[ + "name", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodDNSConfigOption { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodDNSConfigOption", + self.name.as_ref().map_or(0, |_| 1) + + self.value.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodDNSConfigOption { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodDNSConfigOption".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodDNSConfigOption defines DNS resolver options of a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_ip.rs b/src/v1_30/api/core/v1/pod_ip.rs new file mode 100644 index 000000000..6b007178c --- /dev/null +++ b/src/v1_30/api/core/v1/pod_ip.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.PodIP + +/// PodIP represents a single IP address allocated to the pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodIP { + /// IP is the IP address assigned to the pod + pub ip: Option, +} + +impl crate::DeepMerge for PodIP { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodIP { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ip, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ip" => Field::Key_ip, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodIP; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodIP") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ip: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodIP { + ip: value_ip, + }) + } + } + + deserializer.deserialize_struct( + "PodIP", + &[ + "ip", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodIP { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodIP", + self.ip.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodIP { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodIP".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodIP represents a single IP address allocated to the pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IP is the IP address assigned to the pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_os.rs b/src/v1_30/api/core/v1/pod_os.rs new file mode 100644 index 000000000..0ca8f9660 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_os.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.core.v1.PodOS + +/// PodOS defines the OS parameters of a pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodOS { + /// Name is the name of the operating system. The currently supported values are linux and windows. Additional value may be defined in future and can be one of: https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration Clients should expect to handle additional values and treat unrecognized values in this field as os: null + pub name: String, +} + +impl crate::DeepMerge for PodOS { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodOS { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodOS; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodOS") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodOS { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodOS", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodOS { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodOS", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodOS { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodOS".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodOS defines the OS parameters of a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the operating system. The currently supported values are linux and windows. Additional value may be defined in future and can be one of: https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration Clients should expect to handle additional values and treat unrecognized values in this field as os: null".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_readiness_gate.rs b/src/v1_30/api/core/v1/pod_readiness_gate.rs new file mode 100644 index 000000000..3d9f76844 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_readiness_gate.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.core.v1.PodReadinessGate + +/// PodReadinessGate contains the reference to a pod condition +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodReadinessGate { + /// ConditionType refers to a condition in the pod's condition list with matching type. + pub condition_type: String, +} + +impl crate::DeepMerge for PodReadinessGate { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.condition_type, other.condition_type); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodReadinessGate { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_condition_type, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditionType" => Field::Key_condition_type, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodReadinessGate; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodReadinessGate") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_condition_type: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_condition_type => value_condition_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodReadinessGate { + condition_type: value_condition_type.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodReadinessGate", + &[ + "conditionType", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodReadinessGate { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodReadinessGate", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditionType", &self.condition_type)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodReadinessGate { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodReadinessGate".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodReadinessGate contains the reference to a pod condition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditionType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ConditionType refers to a condition in the pod's condition list with matching type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "conditionType".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_resource_claim.rs b/src/v1_30/api/core/v1/pod_resource_claim.rs new file mode 100644 index 000000000..5126f6d29 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_resource_claim.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.PodResourceClaim + +/// PodResourceClaim references exactly one ResourceClaim through a ClaimSource. It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodResourceClaim { + /// Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL. + pub name: String, + + /// Source describes where to find the ResourceClaim. + pub source: Option, +} + +impl crate::DeepMerge for PodResourceClaim { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.source, other.source); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodResourceClaim { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_source, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "source" => Field::Key_source, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodResourceClaim; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodResourceClaim") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_source: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_source => value_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodResourceClaim { + name: value_name.unwrap_or_default(), + source: value_source, + }) + } + } + + deserializer.deserialize_struct( + "PodResourceClaim", + &[ + "name", + "source", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodResourceClaim { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodResourceClaim", + 1 + + self.source.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.source { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "source", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodResourceClaim { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodResourceClaim".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodResourceClaim references exactly one ResourceClaim through a ClaimSource. It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "source".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Source describes where to find the ResourceClaim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_resource_claim_status.rs b/src/v1_30/api/core/v1/pod_resource_claim_status.rs new file mode 100644 index 000000000..8be17bf9d --- /dev/null +++ b/src/v1_30/api/core/v1/pod_resource_claim_status.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.PodResourceClaimStatus + +/// PodResourceClaimStatus is stored in the PodStatus for each PodResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodResourceClaimStatus { + /// Name uniquely identifies this resource claim inside the pod. This must match the name of an entry in pod.spec.resourceClaims, which implies that the string must be a DNS_LABEL. + pub name: String, + + /// ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod. It this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case. + pub resource_claim_name: Option, +} + +impl crate::DeepMerge for PodResourceClaimStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.resource_claim_name, other.resource_claim_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodResourceClaimStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_resource_claim_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "resourceClaimName" => Field::Key_resource_claim_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodResourceClaimStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodResourceClaimStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_resource_claim_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_claim_name => value_resource_claim_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodResourceClaimStatus { + name: value_name.unwrap_or_default(), + resource_claim_name: value_resource_claim_name, + }) + } + } + + deserializer.deserialize_struct( + "PodResourceClaimStatus", + &[ + "name", + "resourceClaimName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodResourceClaimStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodResourceClaimStatus", + 1 + + self.resource_claim_name.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.resource_claim_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaimName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodResourceClaimStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodResourceClaimStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodResourceClaimStatus is stored in the PodStatus for each PodResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name uniquely identifies this resource claim inside the pod. This must match the name of an entry in pod.spec.resourceClaims, which implies that the string must be a DNS_LABEL.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceClaimName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod. It this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_scheduling_gate.rs b/src/v1_30/api/core/v1/pod_scheduling_gate.rs new file mode 100644 index 000000000..1450a4502 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_scheduling_gate.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.core.v1.PodSchedulingGate + +/// PodSchedulingGate is associated to a Pod to guard its scheduling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSchedulingGate { + /// Name of the scheduling gate. Each scheduling gate must have a unique name field. + pub name: String, +} + +impl crate::DeepMerge for PodSchedulingGate { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSchedulingGate { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSchedulingGate; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodSchedulingGate") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSchedulingGate { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PodSchedulingGate", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSchedulingGate { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodSchedulingGate", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSchedulingGate { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodSchedulingGate".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSchedulingGate is associated to a Pod to guard its scheduling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the scheduling gate. Each scheduling gate must have a unique name field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_security_context.rs b/src/v1_30/api/core/v1/pod_security_context.rs new file mode 100644 index 000000000..e64e7ea55 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_security_context.rs @@ -0,0 +1,398 @@ +// Generated from definition io.k8s.api.core.v1.PodSecurityContext + +/// PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSecurityContext { + /// appArmorProfile is the AppArmor options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows. + pub app_armor_profile: Option, + + /// A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: + /// + /// 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- + /// + /// If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows. + pub fs_group: Option, + + /// fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are "OnRootMismatch" and "Always". If not specified, "Always" is used. Note that this field cannot be set when spec.os.name is windows. + pub fs_group_change_policy: Option, + + /// The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + pub run_as_group: Option, + + /// Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + pub run_as_non_root: Option, + + /// The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + pub run_as_user: Option, + + /// The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows. + pub se_linux_options: Option, + + /// The seccomp options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows. + pub seccomp_profile: Option, + + /// A list of groups applied to the first process run in each container, in addition to the container's primary GID, the fsGroup (if specified), and group memberships defined in the container image for the uid of the container process. If unspecified, no additional groups are added to any container. Note that group memberships defined in the container image for the uid of the container process are still effective, even if they are not included in this list. Note that this field cannot be set when spec.os.name is windows. + pub supplemental_groups: Option>, + + /// Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch. Note that this field cannot be set when spec.os.name is windows. + pub sysctls: Option>, + + /// The Windows specific settings applied to all containers. If unspecified, the options within a container's SecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux. + pub windows_options: Option, +} + +impl crate::DeepMerge for PodSecurityContext { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.app_armor_profile, other.app_armor_profile); + crate::DeepMerge::merge_from(&mut self.fs_group, other.fs_group); + crate::DeepMerge::merge_from(&mut self.fs_group_change_policy, other.fs_group_change_policy); + crate::DeepMerge::merge_from(&mut self.run_as_group, other.run_as_group); + crate::DeepMerge::merge_from(&mut self.run_as_non_root, other.run_as_non_root); + crate::DeepMerge::merge_from(&mut self.run_as_user, other.run_as_user); + crate::DeepMerge::merge_from(&mut self.se_linux_options, other.se_linux_options); + crate::DeepMerge::merge_from(&mut self.seccomp_profile, other.seccomp_profile); + crate::merge_strategies::list::atomic(&mut self.supplemental_groups, other.supplemental_groups); + crate::merge_strategies::list::atomic(&mut self.sysctls, other.sysctls); + crate::DeepMerge::merge_from(&mut self.windows_options, other.windows_options); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSecurityContext { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_app_armor_profile, + Key_fs_group, + Key_fs_group_change_policy, + Key_run_as_group, + Key_run_as_non_root, + Key_run_as_user, + Key_se_linux_options, + Key_seccomp_profile, + Key_supplemental_groups, + Key_sysctls, + Key_windows_options, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "appArmorProfile" => Field::Key_app_armor_profile, + "fsGroup" => Field::Key_fs_group, + "fsGroupChangePolicy" => Field::Key_fs_group_change_policy, + "runAsGroup" => Field::Key_run_as_group, + "runAsNonRoot" => Field::Key_run_as_non_root, + "runAsUser" => Field::Key_run_as_user, + "seLinuxOptions" => Field::Key_se_linux_options, + "seccompProfile" => Field::Key_seccomp_profile, + "supplementalGroups" => Field::Key_supplemental_groups, + "sysctls" => Field::Key_sysctls, + "windowsOptions" => Field::Key_windows_options, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSecurityContext; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodSecurityContext") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_app_armor_profile: Option = None; + let mut value_fs_group: Option = None; + let mut value_fs_group_change_policy: Option = None; + let mut value_run_as_group: Option = None; + let mut value_run_as_non_root: Option = None; + let mut value_run_as_user: Option = None; + let mut value_se_linux_options: Option = None; + let mut value_seccomp_profile: Option = None; + let mut value_supplemental_groups: Option> = None; + let mut value_sysctls: Option> = None; + let mut value_windows_options: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_app_armor_profile => value_app_armor_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_group => value_fs_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_group_change_policy => value_fs_group_change_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_group => value_run_as_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_non_root => value_run_as_non_root = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_user => value_run_as_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_se_linux_options => value_se_linux_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_seccomp_profile => value_seccomp_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_supplemental_groups => value_supplemental_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_sysctls => value_sysctls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_windows_options => value_windows_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSecurityContext { + app_armor_profile: value_app_armor_profile, + fs_group: value_fs_group, + fs_group_change_policy: value_fs_group_change_policy, + run_as_group: value_run_as_group, + run_as_non_root: value_run_as_non_root, + run_as_user: value_run_as_user, + se_linux_options: value_se_linux_options, + seccomp_profile: value_seccomp_profile, + supplemental_groups: value_supplemental_groups, + sysctls: value_sysctls, + windows_options: value_windows_options, + }) + } + } + + deserializer.deserialize_struct( + "PodSecurityContext", + &[ + "appArmorProfile", + "fsGroup", + "fsGroupChangePolicy", + "runAsGroup", + "runAsNonRoot", + "runAsUser", + "seLinuxOptions", + "seccompProfile", + "supplementalGroups", + "sysctls", + "windowsOptions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSecurityContext { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodSecurityContext", + self.app_armor_profile.as_ref().map_or(0, |_| 1) + + self.fs_group.as_ref().map_or(0, |_| 1) + + self.fs_group_change_policy.as_ref().map_or(0, |_| 1) + + self.run_as_group.as_ref().map_or(0, |_| 1) + + self.run_as_non_root.as_ref().map_or(0, |_| 1) + + self.run_as_user.as_ref().map_or(0, |_| 1) + + self.se_linux_options.as_ref().map_or(0, |_| 1) + + self.seccomp_profile.as_ref().map_or(0, |_| 1) + + self.supplemental_groups.as_ref().map_or(0, |_| 1) + + self.sysctls.as_ref().map_or(0, |_| 1) + + self.windows_options.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.app_armor_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "appArmorProfile", value)?; + } + if let Some(value) = &self.fs_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsGroup", value)?; + } + if let Some(value) = &self.fs_group_change_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsGroupChangePolicy", value)?; + } + if let Some(value) = &self.run_as_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsGroup", value)?; + } + if let Some(value) = &self.run_as_non_root { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsNonRoot", value)?; + } + if let Some(value) = &self.run_as_user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsUser", value)?; + } + if let Some(value) = &self.se_linux_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seLinuxOptions", value)?; + } + if let Some(value) = &self.seccomp_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seccompProfile", value)?; + } + if let Some(value) = &self.supplemental_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "supplementalGroups", value)?; + } + if let Some(value) = &self.sysctls { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sysctls", value)?; + } + if let Some(value) = &self.windows_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "windowsOptions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSecurityContext { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodSecurityContext".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "appArmorProfile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("appArmorProfile is the AppArmor options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "fsGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "fsGroupChangePolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsGroupChangePolicy defines behavior of changing ownership and permission of the volume before being exposed inside Pod. This field will only apply to volume types which support fsGroup based ownership(and permissions). It will have no effect on ephemeral volume types such as: secret, configmaps and emptydir. Valid values are \"OnRootMismatch\" and \"Always\". If not specified, \"Always\" is used. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "runAsGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "runAsNonRoot".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "runAsUser".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "seLinuxOptions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "seccompProfile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The seccomp options to use by the containers in this pod. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "supplementalGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of groups applied to the first process run in each container, in addition to the container's primary GID, the fsGroup (if specified), and group memberships defined in the container image for the uid of the container process. If unspecified, no additional groups are added to any container. Note that group memberships defined in the container image for the uid of the container process are still effective, even if they are not included in this list. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "sysctls".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "windowsOptions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Windows specific settings applied to all containers. If unspecified, the options within a container's SecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_spec.rs b/src/v1_30/api/core/v1/pod_spec.rs new file mode 100644 index 000000000..5358af4de --- /dev/null +++ b/src/v1_30/api/core/v1/pod_spec.rs @@ -0,0 +1,1213 @@ +// Generated from definition io.k8s.api.core.v1.PodSpec + +/// PodSpec is a description of a pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSpec { + /// Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer. + pub active_deadline_seconds: Option, + + /// If specified, the pod's scheduling constraints + pub affinity: Option, + + /// AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. + pub automount_service_account_token: Option, + + /// List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated. + pub containers: Vec, + + /// Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy. + pub dns_config: Option, + + /// Set DNS policy for the pod. Defaults to "ClusterFirst". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'. + pub dns_policy: Option, + + /// EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true. + pub enable_service_links: Option, + + /// List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource. + pub ephemeral_containers: Option>, + + /// HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + pub host_aliases: Option>, + + /// Use the host's ipc namespace. Optional: Default to false. + pub host_ipc: Option, + + /// Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false. + pub host_network: Option, + + /// Use the host's pid namespace. Optional: Default to false. + pub host_pid: Option, + + /// Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. + pub host_users: Option, + + /// Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value. + pub hostname: Option, + + /// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod + pub image_pull_secrets: Option>, + + /// List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ + pub init_containers: Option>, + + /// NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements. + pub node_name: Option, + + /// NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + pub node_selector: Option>, + + /// Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set. + /// + /// If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions + /// + /// If the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers\[*\].securityContext.appArmorProfile - spec.containers\[*\].securityContext.seLinuxOptions - spec.containers\[*\].securityContext.seccompProfile - spec.containers\[*\].securityContext.capabilities - spec.containers\[*\].securityContext.readOnlyRootFilesystem - spec.containers\[*\].securityContext.privileged - spec.containers\[*\].securityContext.allowPrivilegeEscalation - spec.containers\[*\].securityContext.procMount - spec.containers\[*\].securityContext.runAsUser - spec.containers\[*\].securityContext.runAsGroup + pub os: Option, + + /// Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md + pub overhead: Option>, + + /// PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + pub preemption_policy: Option, + + /// The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. + pub priority: Option, + + /// If specified, indicates the pod's priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default. + pub priority_class_name: Option, + + /// If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to "True" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates + pub readiness_gates: Option>, + + /// ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name. + /// + /// This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. + /// + /// This field is immutable. + pub resource_claims: Option>, + + /// Restart policy for all containers within the pod. One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy + pub restart_policy: Option, + + /// RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class + pub runtime_class_name: Option, + + /// If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler. + pub scheduler_name: Option, + + /// SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod. + /// + /// SchedulingGates can only be set at pod creation time, and be removed only afterwards. + pub scheduling_gates: Option>, + + /// SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field. + pub security_context: Option, + + /// DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead. + pub service_account: Option, + + /// ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + pub service_account_name: Option, + + /// If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false. + pub set_hostname_as_fqdn: Option, + + /// Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false. + pub share_process_namespace: Option, + + /// If specified, the fully qualified Pod hostname will be "\.\.\.svc.\". If not specified, the pod will not have a domainname at all. + pub subdomain: Option, + + /// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds. + pub termination_grace_period_seconds: Option, + + /// If specified, the pod's tolerations. + pub tolerations: Option>, + + /// TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed. + pub topology_spread_constraints: Option>, + + /// List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes + pub volumes: Option>, +} + +impl crate::DeepMerge for PodSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.active_deadline_seconds, other.active_deadline_seconds); + crate::DeepMerge::merge_from(&mut self.affinity, other.affinity); + crate::DeepMerge::merge_from(&mut self.automount_service_account_token, other.automount_service_account_token); + crate::merge_strategies::list::map( + &mut self.containers, + other.containers, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.dns_config, other.dns_config); + crate::DeepMerge::merge_from(&mut self.dns_policy, other.dns_policy); + crate::DeepMerge::merge_from(&mut self.enable_service_links, other.enable_service_links); + crate::merge_strategies::list::map( + &mut self.ephemeral_containers, + other.ephemeral_containers, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.host_aliases, + other.host_aliases, + &[|lhs, rhs| lhs.ip == rhs.ip], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.host_ipc, other.host_ipc); + crate::DeepMerge::merge_from(&mut self.host_network, other.host_network); + crate::DeepMerge::merge_from(&mut self.host_pid, other.host_pid); + crate::DeepMerge::merge_from(&mut self.host_users, other.host_users); + crate::DeepMerge::merge_from(&mut self.hostname, other.hostname); + crate::merge_strategies::list::map( + &mut self.image_pull_secrets, + other.image_pull_secrets, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.init_containers, + other.init_containers, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::merge_strategies::map::atomic(&mut self.node_selector, other.node_selector); + crate::DeepMerge::merge_from(&mut self.os, other.os); + crate::merge_strategies::map::granular(&mut self.overhead, other.overhead, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.preemption_policy, other.preemption_policy); + crate::DeepMerge::merge_from(&mut self.priority, other.priority); + crate::DeepMerge::merge_from(&mut self.priority_class_name, other.priority_class_name); + crate::merge_strategies::list::atomic(&mut self.readiness_gates, other.readiness_gates); + crate::merge_strategies::list::map( + &mut self.resource_claims, + other.resource_claims, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.restart_policy, other.restart_policy); + crate::DeepMerge::merge_from(&mut self.runtime_class_name, other.runtime_class_name); + crate::DeepMerge::merge_from(&mut self.scheduler_name, other.scheduler_name); + crate::merge_strategies::list::map( + &mut self.scheduling_gates, + other.scheduling_gates, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.security_context, other.security_context); + crate::DeepMerge::merge_from(&mut self.service_account, other.service_account); + crate::DeepMerge::merge_from(&mut self.service_account_name, other.service_account_name); + crate::DeepMerge::merge_from(&mut self.set_hostname_as_fqdn, other.set_hostname_as_fqdn); + crate::DeepMerge::merge_from(&mut self.share_process_namespace, other.share_process_namespace); + crate::DeepMerge::merge_from(&mut self.subdomain, other.subdomain); + crate::DeepMerge::merge_from(&mut self.termination_grace_period_seconds, other.termination_grace_period_seconds); + crate::merge_strategies::list::atomic(&mut self.tolerations, other.tolerations); + crate::merge_strategies::list::map( + &mut self.topology_spread_constraints, + other.topology_spread_constraints, + &[|lhs, rhs| lhs.topology_key == rhs.topology_key], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::map( + &mut self.volumes, + other.volumes, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_active_deadline_seconds, + Key_affinity, + Key_automount_service_account_token, + Key_containers, + Key_dns_config, + Key_dns_policy, + Key_enable_service_links, + Key_ephemeral_containers, + Key_host_aliases, + Key_host_ipc, + Key_host_network, + Key_host_pid, + Key_host_users, + Key_hostname, + Key_image_pull_secrets, + Key_init_containers, + Key_node_name, + Key_node_selector, + Key_os, + Key_overhead, + Key_preemption_policy, + Key_priority, + Key_priority_class_name, + Key_readiness_gates, + Key_resource_claims, + Key_restart_policy, + Key_runtime_class_name, + Key_scheduler_name, + Key_scheduling_gates, + Key_security_context, + Key_service_account, + Key_service_account_name, + Key_set_hostname_as_fqdn, + Key_share_process_namespace, + Key_subdomain, + Key_termination_grace_period_seconds, + Key_tolerations, + Key_topology_spread_constraints, + Key_volumes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "activeDeadlineSeconds" => Field::Key_active_deadline_seconds, + "affinity" => Field::Key_affinity, + "automountServiceAccountToken" => Field::Key_automount_service_account_token, + "containers" => Field::Key_containers, + "dnsConfig" => Field::Key_dns_config, + "dnsPolicy" => Field::Key_dns_policy, + "enableServiceLinks" => Field::Key_enable_service_links, + "ephemeralContainers" => Field::Key_ephemeral_containers, + "hostAliases" => Field::Key_host_aliases, + "hostIPC" => Field::Key_host_ipc, + "hostNetwork" => Field::Key_host_network, + "hostPID" => Field::Key_host_pid, + "hostUsers" => Field::Key_host_users, + "hostname" => Field::Key_hostname, + "imagePullSecrets" => Field::Key_image_pull_secrets, + "initContainers" => Field::Key_init_containers, + "nodeName" => Field::Key_node_name, + "nodeSelector" => Field::Key_node_selector, + "os" => Field::Key_os, + "overhead" => Field::Key_overhead, + "preemptionPolicy" => Field::Key_preemption_policy, + "priority" => Field::Key_priority, + "priorityClassName" => Field::Key_priority_class_name, + "readinessGates" => Field::Key_readiness_gates, + "resourceClaims" => Field::Key_resource_claims, + "restartPolicy" => Field::Key_restart_policy, + "runtimeClassName" => Field::Key_runtime_class_name, + "schedulerName" => Field::Key_scheduler_name, + "schedulingGates" => Field::Key_scheduling_gates, + "securityContext" => Field::Key_security_context, + "serviceAccount" => Field::Key_service_account, + "serviceAccountName" => Field::Key_service_account_name, + "setHostnameAsFQDN" => Field::Key_set_hostname_as_fqdn, + "shareProcessNamespace" => Field::Key_share_process_namespace, + "subdomain" => Field::Key_subdomain, + "terminationGracePeriodSeconds" => Field::Key_termination_grace_period_seconds, + "tolerations" => Field::Key_tolerations, + "topologySpreadConstraints" => Field::Key_topology_spread_constraints, + "volumes" => Field::Key_volumes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_active_deadline_seconds: Option = None; + let mut value_affinity: Option = None; + let mut value_automount_service_account_token: Option = None; + let mut value_containers: Option> = None; + let mut value_dns_config: Option = None; + let mut value_dns_policy: Option = None; + let mut value_enable_service_links: Option = None; + let mut value_ephemeral_containers: Option> = None; + let mut value_host_aliases: Option> = None; + let mut value_host_ipc: Option = None; + let mut value_host_network: Option = None; + let mut value_host_pid: Option = None; + let mut value_host_users: Option = None; + let mut value_hostname: Option = None; + let mut value_image_pull_secrets: Option> = None; + let mut value_init_containers: Option> = None; + let mut value_node_name: Option = None; + let mut value_node_selector: Option> = None; + let mut value_os: Option = None; + let mut value_overhead: Option> = None; + let mut value_preemption_policy: Option = None; + let mut value_priority: Option = None; + let mut value_priority_class_name: Option = None; + let mut value_readiness_gates: Option> = None; + let mut value_resource_claims: Option> = None; + let mut value_restart_policy: Option = None; + let mut value_runtime_class_name: Option = None; + let mut value_scheduler_name: Option = None; + let mut value_scheduling_gates: Option> = None; + let mut value_security_context: Option = None; + let mut value_service_account: Option = None; + let mut value_service_account_name: Option = None; + let mut value_set_hostname_as_fqdn: Option = None; + let mut value_share_process_namespace: Option = None; + let mut value_subdomain: Option = None; + let mut value_termination_grace_period_seconds: Option = None; + let mut value_tolerations: Option> = None; + let mut value_topology_spread_constraints: Option> = None; + let mut value_volumes: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_active_deadline_seconds => value_active_deadline_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_affinity => value_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_automount_service_account_token => value_automount_service_account_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_containers => value_containers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_dns_config => value_dns_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_dns_policy => value_dns_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_enable_service_links => value_enable_service_links = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ephemeral_containers => value_ephemeral_containers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_aliases => value_host_aliases = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_ipc => value_host_ipc = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_network => value_host_network = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_pid => value_host_pid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_users => value_host_users = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_hostname => value_hostname = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image_pull_secrets => value_image_pull_secrets = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_init_containers => value_init_containers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_selector => value_node_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_os => value_os = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_overhead => value_overhead = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_preemption_policy => value_preemption_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_priority => value_priority = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_priority_class_name => value_priority_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_readiness_gates => value_readiness_gates = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_claims => value_resource_claims = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_restart_policy => value_restart_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_runtime_class_name => value_runtime_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scheduler_name => value_scheduler_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scheduling_gates => value_scheduling_gates = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_security_context => value_security_context = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_account => value_service_account = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_account_name => value_service_account_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_set_hostname_as_fqdn => value_set_hostname_as_fqdn = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_share_process_namespace => value_share_process_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subdomain => value_subdomain = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_grace_period_seconds => value_termination_grace_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tolerations => value_tolerations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_topology_spread_constraints => value_topology_spread_constraints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volumes => value_volumes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSpec { + active_deadline_seconds: value_active_deadline_seconds, + affinity: value_affinity, + automount_service_account_token: value_automount_service_account_token, + containers: value_containers.unwrap_or_default(), + dns_config: value_dns_config, + dns_policy: value_dns_policy, + enable_service_links: value_enable_service_links, + ephemeral_containers: value_ephemeral_containers, + host_aliases: value_host_aliases, + host_ipc: value_host_ipc, + host_network: value_host_network, + host_pid: value_host_pid, + host_users: value_host_users, + hostname: value_hostname, + image_pull_secrets: value_image_pull_secrets, + init_containers: value_init_containers, + node_name: value_node_name, + node_selector: value_node_selector, + os: value_os, + overhead: value_overhead, + preemption_policy: value_preemption_policy, + priority: value_priority, + priority_class_name: value_priority_class_name, + readiness_gates: value_readiness_gates, + resource_claims: value_resource_claims, + restart_policy: value_restart_policy, + runtime_class_name: value_runtime_class_name, + scheduler_name: value_scheduler_name, + scheduling_gates: value_scheduling_gates, + security_context: value_security_context, + service_account: value_service_account, + service_account_name: value_service_account_name, + set_hostname_as_fqdn: value_set_hostname_as_fqdn, + share_process_namespace: value_share_process_namespace, + subdomain: value_subdomain, + termination_grace_period_seconds: value_termination_grace_period_seconds, + tolerations: value_tolerations, + topology_spread_constraints: value_topology_spread_constraints, + volumes: value_volumes, + }) + } + } + + deserializer.deserialize_struct( + "PodSpec", + &[ + "activeDeadlineSeconds", + "affinity", + "automountServiceAccountToken", + "containers", + "dnsConfig", + "dnsPolicy", + "enableServiceLinks", + "ephemeralContainers", + "hostAliases", + "hostIPC", + "hostNetwork", + "hostPID", + "hostUsers", + "hostname", + "imagePullSecrets", + "initContainers", + "nodeName", + "nodeSelector", + "os", + "overhead", + "preemptionPolicy", + "priority", + "priorityClassName", + "readinessGates", + "resourceClaims", + "restartPolicy", + "runtimeClassName", + "schedulerName", + "schedulingGates", + "securityContext", + "serviceAccount", + "serviceAccountName", + "setHostnameAsFQDN", + "shareProcessNamespace", + "subdomain", + "terminationGracePeriodSeconds", + "tolerations", + "topologySpreadConstraints", + "volumes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodSpec", + 1 + + self.active_deadline_seconds.as_ref().map_or(0, |_| 1) + + self.affinity.as_ref().map_or(0, |_| 1) + + self.automount_service_account_token.as_ref().map_or(0, |_| 1) + + self.dns_config.as_ref().map_or(0, |_| 1) + + self.dns_policy.as_ref().map_or(0, |_| 1) + + self.enable_service_links.as_ref().map_or(0, |_| 1) + + self.ephemeral_containers.as_ref().map_or(0, |_| 1) + + self.host_aliases.as_ref().map_or(0, |_| 1) + + self.host_ipc.as_ref().map_or(0, |_| 1) + + self.host_network.as_ref().map_or(0, |_| 1) + + self.host_pid.as_ref().map_or(0, |_| 1) + + self.host_users.as_ref().map_or(0, |_| 1) + + self.hostname.as_ref().map_or(0, |_| 1) + + self.image_pull_secrets.as_ref().map_or(0, |_| 1) + + self.init_containers.as_ref().map_or(0, |_| 1) + + self.node_name.as_ref().map_or(0, |_| 1) + + self.node_selector.as_ref().map_or(0, |_| 1) + + self.os.as_ref().map_or(0, |_| 1) + + self.overhead.as_ref().map_or(0, |_| 1) + + self.preemption_policy.as_ref().map_or(0, |_| 1) + + self.priority.as_ref().map_or(0, |_| 1) + + self.priority_class_name.as_ref().map_or(0, |_| 1) + + self.readiness_gates.as_ref().map_or(0, |_| 1) + + self.resource_claims.as_ref().map_or(0, |_| 1) + + self.restart_policy.as_ref().map_or(0, |_| 1) + + self.runtime_class_name.as_ref().map_or(0, |_| 1) + + self.scheduler_name.as_ref().map_or(0, |_| 1) + + self.scheduling_gates.as_ref().map_or(0, |_| 1) + + self.security_context.as_ref().map_or(0, |_| 1) + + self.service_account.as_ref().map_or(0, |_| 1) + + self.service_account_name.as_ref().map_or(0, |_| 1) + + self.set_hostname_as_fqdn.as_ref().map_or(0, |_| 1) + + self.share_process_namespace.as_ref().map_or(0, |_| 1) + + self.subdomain.as_ref().map_or(0, |_| 1) + + self.termination_grace_period_seconds.as_ref().map_or(0, |_| 1) + + self.tolerations.as_ref().map_or(0, |_| 1) + + self.topology_spread_constraints.as_ref().map_or(0, |_| 1) + + self.volumes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.active_deadline_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "activeDeadlineSeconds", value)?; + } + if let Some(value) = &self.affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "affinity", value)?; + } + if let Some(value) = &self.automount_service_account_token { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "automountServiceAccountToken", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containers", &self.containers)?; + if let Some(value) = &self.dns_config { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dnsConfig", value)?; + } + if let Some(value) = &self.dns_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dnsPolicy", value)?; + } + if let Some(value) = &self.enable_service_links { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "enableServiceLinks", value)?; + } + if let Some(value) = &self.ephemeral_containers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ephemeralContainers", value)?; + } + if let Some(value) = &self.host_aliases { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostAliases", value)?; + } + if let Some(value) = &self.host_ipc { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostIPC", value)?; + } + if let Some(value) = &self.host_network { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostNetwork", value)?; + } + if let Some(value) = &self.host_pid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPID", value)?; + } + if let Some(value) = &self.host_users { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostUsers", value)?; + } + if let Some(value) = &self.hostname { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostname", value)?; + } + if let Some(value) = &self.image_pull_secrets { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "imagePullSecrets", value)?; + } + if let Some(value) = &self.init_containers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "initContainers", value)?; + } + if let Some(value) = &self.node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?; + } + if let Some(value) = &self.node_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelector", value)?; + } + if let Some(value) = &self.os { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "os", value)?; + } + if let Some(value) = &self.overhead { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "overhead", value)?; + } + if let Some(value) = &self.preemption_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preemptionPolicy", value)?; + } + if let Some(value) = &self.priority { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "priority", value)?; + } + if let Some(value) = &self.priority_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "priorityClassName", value)?; + } + if let Some(value) = &self.readiness_gates { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readinessGates", value)?; + } + if let Some(value) = &self.resource_claims { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaims", value)?; + } + if let Some(value) = &self.restart_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "restartPolicy", value)?; + } + if let Some(value) = &self.runtime_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runtimeClassName", value)?; + } + if let Some(value) = &self.scheduler_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "schedulerName", value)?; + } + if let Some(value) = &self.scheduling_gates { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "schedulingGates", value)?; + } + if let Some(value) = &self.security_context { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "securityContext", value)?; + } + if let Some(value) = &self.service_account { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccount", value)?; + } + if let Some(value) = &self.service_account_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccountName", value)?; + } + if let Some(value) = &self.set_hostname_as_fqdn { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "setHostnameAsFQDN", value)?; + } + if let Some(value) = &self.share_process_namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shareProcessNamespace", value)?; + } + if let Some(value) = &self.subdomain { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subdomain", value)?; + } + if let Some(value) = &self.termination_grace_period_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationGracePeriodSeconds", value)?; + } + if let Some(value) = &self.tolerations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tolerations", value)?; + } + if let Some(value) = &self.topology_spread_constraints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "topologySpreadConstraints", value)?; + } + if let Some(value) = &self.volumes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSpec is a description of a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "activeDeadlineSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "affinity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the pod's scheduling constraints".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "automountServiceAccountToken".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "containers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "dnsConfig".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "dnsPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "enableServiceLinks".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "ephemeralContainers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "hostAliases".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "hostIPC".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Use the host's ipc namespace. Optional: Default to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "hostNetwork".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "hostPID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Use the host's pid namespace. Optional: Default to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "hostUsers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "hostname".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "imagePullSecrets".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "initContainers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeSelector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "os".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "overhead".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "preemptionPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "priority".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "priorityClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, indicates the pod's priority. \"system-node-critical\" and \"system-cluster-critical\" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readinessGates".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceClaims".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "restartPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Restart policy for all containers within the pod. One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "runtimeClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "schedulerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "schedulingGates".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "securityContext".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "serviceAccount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "serviceAccountName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "setHostnameAsFQDN".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "shareProcessNamespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "subdomain".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the fully qualified Pod hostname will be \"...svc.\". If not specified, the pod will not have a domainname at all.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "terminationGracePeriodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "tolerations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the pod's tolerations.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "topologySpreadConstraints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "containers".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_status.rs b/src/v1_30/api/core/v1/pod_status.rs new file mode 100644 index 000000000..08aff84c0 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_status.rs @@ -0,0 +1,562 @@ +// Generated from definition io.k8s.api.core.v1.PodStatus + +/// PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodStatus { + /// Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions + pub conditions: Option>, + + /// The list has one entry per container in the manifest. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status + pub container_statuses: Option>, + + /// Status for any ephemeral containers that have run in this pod. + pub ephemeral_container_statuses: Option>, + + /// hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod + pub host_ip: Option, + + /// hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod. + pub host_ips: Option>, + + /// The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status + pub init_container_statuses: Option>, + + /// A human readable message indicating details about why the pod is in this condition. + pub message: Option, + + /// nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled. + pub nominated_node_name: Option, + + /// The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values: + /// + /// Pending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod. + /// + /// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase + pub phase: Option, + + /// podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated. + pub pod_ip: Option, + + /// podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet. + pub pod_ips: Option>, + + /// The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes + pub qos_class: Option, + + /// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted' + pub reason: Option, + + /// Status of resources resize desired for pod's containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to "Proposed" + pub resize: Option, + + /// Status of resource claims. + pub resource_claim_statuses: Option>, + + /// RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod. + pub start_time: Option, +} + +impl crate::DeepMerge for PodStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.container_statuses, other.container_statuses); + crate::merge_strategies::list::atomic(&mut self.ephemeral_container_statuses, other.ephemeral_container_statuses); + crate::DeepMerge::merge_from(&mut self.host_ip, other.host_ip); + crate::merge_strategies::list::map( + &mut self.host_ips, + other.host_ips, + &[|lhs, rhs| lhs.ip == rhs.ip], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.init_container_statuses, other.init_container_statuses); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.nominated_node_name, other.nominated_node_name); + crate::DeepMerge::merge_from(&mut self.phase, other.phase); + crate::DeepMerge::merge_from(&mut self.pod_ip, other.pod_ip); + crate::merge_strategies::list::map( + &mut self.pod_ips, + other.pod_ips, + &[|lhs, rhs| lhs.ip == rhs.ip], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.qos_class, other.qos_class); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.resize, other.resize); + crate::merge_strategies::list::map( + &mut self.resource_claim_statuses, + other.resource_claim_statuses, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.start_time, other.start_time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_container_statuses, + Key_ephemeral_container_statuses, + Key_host_ip, + Key_host_ips, + Key_init_container_statuses, + Key_message, + Key_nominated_node_name, + Key_phase, + Key_pod_ip, + Key_pod_ips, + Key_qos_class, + Key_reason, + Key_resize, + Key_resource_claim_statuses, + Key_start_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "containerStatuses" => Field::Key_container_statuses, + "ephemeralContainerStatuses" => Field::Key_ephemeral_container_statuses, + "hostIP" => Field::Key_host_ip, + "hostIPs" => Field::Key_host_ips, + "initContainerStatuses" => Field::Key_init_container_statuses, + "message" => Field::Key_message, + "nominatedNodeName" => Field::Key_nominated_node_name, + "phase" => Field::Key_phase, + "podIP" => Field::Key_pod_ip, + "podIPs" => Field::Key_pod_ips, + "qosClass" => Field::Key_qos_class, + "reason" => Field::Key_reason, + "resize" => Field::Key_resize, + "resourceClaimStatuses" => Field::Key_resource_claim_statuses, + "startTime" => Field::Key_start_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_container_statuses: Option> = None; + let mut value_ephemeral_container_statuses: Option> = None; + let mut value_host_ip: Option = None; + let mut value_host_ips: Option> = None; + let mut value_init_container_statuses: Option> = None; + let mut value_message: Option = None; + let mut value_nominated_node_name: Option = None; + let mut value_phase: Option = None; + let mut value_pod_ip: Option = None; + let mut value_pod_ips: Option> = None; + let mut value_qos_class: Option = None; + let mut value_reason: Option = None; + let mut value_resize: Option = None; + let mut value_resource_claim_statuses: Option> = None; + let mut value_start_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_container_statuses => value_container_statuses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ephemeral_container_statuses => value_ephemeral_container_statuses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_ip => value_host_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_ips => value_host_ips = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_init_container_statuses => value_init_container_statuses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nominated_node_name => value_nominated_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_phase => value_phase = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_ip => value_pod_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_ips => value_pod_ips = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_qos_class => value_qos_class = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resize => value_resize = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_claim_statuses => value_resource_claim_statuses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_start_time => value_start_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodStatus { + conditions: value_conditions, + container_statuses: value_container_statuses, + ephemeral_container_statuses: value_ephemeral_container_statuses, + host_ip: value_host_ip, + host_ips: value_host_ips, + init_container_statuses: value_init_container_statuses, + message: value_message, + nominated_node_name: value_nominated_node_name, + phase: value_phase, + pod_ip: value_pod_ip, + pod_ips: value_pod_ips, + qos_class: value_qos_class, + reason: value_reason, + resize: value_resize, + resource_claim_statuses: value_resource_claim_statuses, + start_time: value_start_time, + }) + } + } + + deserializer.deserialize_struct( + "PodStatus", + &[ + "conditions", + "containerStatuses", + "ephemeralContainerStatuses", + "hostIP", + "hostIPs", + "initContainerStatuses", + "message", + "nominatedNodeName", + "phase", + "podIP", + "podIPs", + "qosClass", + "reason", + "resize", + "resourceClaimStatuses", + "startTime", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.container_statuses.as_ref().map_or(0, |_| 1) + + self.ephemeral_container_statuses.as_ref().map_or(0, |_| 1) + + self.host_ip.as_ref().map_or(0, |_| 1) + + self.host_ips.as_ref().map_or(0, |_| 1) + + self.init_container_statuses.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.nominated_node_name.as_ref().map_or(0, |_| 1) + + self.phase.as_ref().map_or(0, |_| 1) + + self.pod_ip.as_ref().map_or(0, |_| 1) + + self.pod_ips.as_ref().map_or(0, |_| 1) + + self.qos_class.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.resize.as_ref().map_or(0, |_| 1) + + self.resource_claim_statuses.as_ref().map_or(0, |_| 1) + + self.start_time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.container_statuses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerStatuses", value)?; + } + if let Some(value) = &self.ephemeral_container_statuses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ephemeralContainerStatuses", value)?; + } + if let Some(value) = &self.host_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostIP", value)?; + } + if let Some(value) = &self.host_ips { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostIPs", value)?; + } + if let Some(value) = &self.init_container_statuses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "initContainerStatuses", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.nominated_node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nominatedNodeName", value)?; + } + if let Some(value) = &self.phase { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "phase", value)?; + } + if let Some(value) = &self.pod_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podIP", value)?; + } + if let Some(value) = &self.pod_ips { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podIPs", value)?; + } + if let Some(value) = &self.qos_class { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "qosClass", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.resize { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resize", value)?; + } + if let Some(value) = &self.resource_claim_statuses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaimStatuses", value)?; + } + if let Some(value) = &self.start_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "startTime", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "containerStatuses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The list has one entry per container in the manifest. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ephemeralContainerStatuses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status for any ephemeral containers that have run in this pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "hostIP".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "hostIPs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "initContainerStatuses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about why the pod is in this condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nominatedNodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "phase".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values:\n\nPending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "podIP".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "podIPs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "qosClass".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resize".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of resources resize desired for pod's containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to \"Proposed\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resourceClaimStatuses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of resource claims.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "startTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_template.rs b/src/v1_30/api/core/v1/pod_template.rs new file mode 100644 index 000000000..05822b28a --- /dev/null +++ b/src/v1_30/api/core/v1/pod_template.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.core.v1.PodTemplate + +/// PodTemplate describes a template for creating copies of a predefined pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodTemplate { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub template: Option, +} + +impl crate::Resource for PodTemplate { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "PodTemplate"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "podtemplates"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for PodTemplate { + const LIST_KIND: &'static str = "PodTemplateList"; +} + +impl crate::Metadata for PodTemplate { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PodTemplate { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.template, other.template); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodTemplate { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_template, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "template" => Field::Key_template, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodTemplate; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_template: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodTemplate { + metadata: value_metadata.unwrap_or_default(), + template: value_template, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "template", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodTemplate { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.template.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.template { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodTemplate { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodTemplate".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodTemplate describes a template for creating copies of a predefined pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/pod_template_spec.rs b/src/v1_30/api/core/v1/pod_template_spec.rs new file mode 100644 index 000000000..37df06ce1 --- /dev/null +++ b/src/v1_30/api/core/v1/pod_template_spec.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.PodTemplateSpec + +/// PodTemplateSpec describes the data a pod should have when created from a template +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodTemplateSpec { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: Option, + + /// Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::DeepMerge for PodTemplateSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodTemplateSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodTemplateSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodTemplateSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodTemplateSpec { + metadata: value_metadata, + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + "PodTemplateSpec", + &[ + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodTemplateSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodTemplateSpec", + self.metadata.as_ref().map_or(0, |_| 1) + + self.spec.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.metadata { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", value)?; + } + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodTemplateSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.PodTemplateSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodTemplateSpec describes the data a pod should have when created from a template".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/port_status.rs b/src/v1_30/api/core/v1/port_status.rs new file mode 100644 index 000000000..4d97d262a --- /dev/null +++ b/src/v1_30/api/core/v1/port_status.rs @@ -0,0 +1,175 @@ +// Generated from definition io.k8s.api.core.v1.PortStatus + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PortStatus { + /// Error is to record the problem with the service port The format of the error shall comply with the following rules: - built-in error values shall be specified in this file and those shall use + /// CamelCase names + /// - cloud provider specific error values must have names that comply with the + /// format foo.example.com/CamelCase. + pub error: Option, + + /// Port is the port number of the service port of which status is recorded here + pub port: i32, + + /// Protocol is the protocol of the service port of which status is recorded here The supported values are: "TCP", "UDP", "SCTP" + pub protocol: String, +} + +impl crate::DeepMerge for PortStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.error, other.error); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PortStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_error, + Key_port, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "error" => Field::Key_error, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PortStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PortStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_error: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_error => value_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PortStatus { + error: value_error, + port: value_port.unwrap_or_default(), + protocol: value_protocol.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PortStatus", + &[ + "error", + "port", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PortStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PortStatus", + 2 + + self.error.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "error", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", &self.protocol)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PortStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.PortStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "error".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Error is to record the problem with the service port The format of the error shall comply with the following rules: - built-in error values shall be specified in this file and those shall use\n CamelCase names\n- cloud provider specific error values must have names that comply with the\n format foo.example.com/CamelCase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Port is the port number of the service port of which status is recorded here".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Protocol is the protocol of the service port of which status is recorded here The supported values are: \"TCP\", \"UDP\", \"SCTP\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "port".to_owned(), + "protocol".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/portworx_volume_source.rs b/src/v1_30/api/core/v1/portworx_volume_source.rs new file mode 100644 index 000000000..26a21ce6d --- /dev/null +++ b/src/v1_30/api/core/v1/portworx_volume_source.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.core.v1.PortworxVolumeSource + +/// PortworxVolumeSource represents a Portworx volume resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PortworxVolumeSource { + /// fSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// volumeID uniquely identifies a Portworx volume + pub volume_id: String, +} + +impl crate::DeepMerge for PortworxVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.volume_id, other.volume_id); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PortworxVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_read_only, + Key_volume_id, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "readOnly" => Field::Key_read_only, + "volumeID" => Field::Key_volume_id, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PortworxVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PortworxVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_read_only: Option = None; + let mut value_volume_id: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_id => value_volume_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PortworxVolumeSource { + fs_type: value_fs_type, + read_only: value_read_only, + volume_id: value_volume_id.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PortworxVolumeSource", + &[ + "fsType", + "readOnly", + "volumeID", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PortworxVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PortworxVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeID", &self.volume_id)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PortworxVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.PortworxVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PortworxVolumeSource represents a Portworx volume resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "volumeID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeID uniquely identifies a Portworx volume".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "volumeID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/preferred_scheduling_term.rs b/src/v1_30/api/core/v1/preferred_scheduling_term.rs new file mode 100644 index 000000000..a14c07c75 --- /dev/null +++ b/src/v1_30/api/core/v1/preferred_scheduling_term.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.PreferredSchedulingTerm + +/// An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PreferredSchedulingTerm { + /// A node selector term, associated with the corresponding weight. + pub preference: crate::api::core::v1::NodeSelectorTerm, + + /// Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. + pub weight: i32, +} + +impl crate::DeepMerge for PreferredSchedulingTerm { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.preference, other.preference); + crate::DeepMerge::merge_from(&mut self.weight, other.weight); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PreferredSchedulingTerm { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_preference, + Key_weight, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "preference" => Field::Key_preference, + "weight" => Field::Key_weight, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PreferredSchedulingTerm; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PreferredSchedulingTerm") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_preference: Option = None; + let mut value_weight: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_preference => value_preference = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_weight => value_weight = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PreferredSchedulingTerm { + preference: value_preference.unwrap_or_default(), + weight: value_weight.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PreferredSchedulingTerm", + &[ + "preference", + "weight", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PreferredSchedulingTerm { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PreferredSchedulingTerm", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preference", &self.preference)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "weight", &self.weight)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PreferredSchedulingTerm { + fn schema_name() -> String { + "io.k8s.api.core.v1.PreferredSchedulingTerm".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "preference".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A node selector term, associated with the corresponding weight.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "weight".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "preference".to_owned(), + "weight".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/probe.rs b/src/v1_30/api/core/v1/probe.rs new file mode 100644 index 000000000..5936dd5e4 --- /dev/null +++ b/src/v1_30/api/core/v1/probe.rs @@ -0,0 +1,358 @@ +// Generated from definition io.k8s.api.core.v1.Probe + +/// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Probe { + /// Exec specifies the action to take. + pub exec: Option, + + /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. + pub failure_threshold: Option, + + /// GRPC specifies an action involving a GRPC port. + pub grpc: Option, + + /// HTTPGet specifies the http request to perform. + pub http_get: Option, + + /// Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + pub initial_delay_seconds: Option, + + /// How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. + pub period_seconds: Option, + + /// Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + pub success_threshold: Option, + + /// TCPSocket specifies an action involving a TCP port. + pub tcp_socket: Option, + + /// Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + pub termination_grace_period_seconds: Option, + + /// Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + pub timeout_seconds: Option, +} + +impl crate::DeepMerge for Probe { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.exec, other.exec); + crate::DeepMerge::merge_from(&mut self.failure_threshold, other.failure_threshold); + crate::DeepMerge::merge_from(&mut self.grpc, other.grpc); + crate::DeepMerge::merge_from(&mut self.http_get, other.http_get); + crate::DeepMerge::merge_from(&mut self.initial_delay_seconds, other.initial_delay_seconds); + crate::DeepMerge::merge_from(&mut self.period_seconds, other.period_seconds); + crate::DeepMerge::merge_from(&mut self.success_threshold, other.success_threshold); + crate::DeepMerge::merge_from(&mut self.tcp_socket, other.tcp_socket); + crate::DeepMerge::merge_from(&mut self.termination_grace_period_seconds, other.termination_grace_period_seconds); + crate::DeepMerge::merge_from(&mut self.timeout_seconds, other.timeout_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Probe { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exec, + Key_failure_threshold, + Key_grpc, + Key_http_get, + Key_initial_delay_seconds, + Key_period_seconds, + Key_success_threshold, + Key_tcp_socket, + Key_termination_grace_period_seconds, + Key_timeout_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "exec" => Field::Key_exec, + "failureThreshold" => Field::Key_failure_threshold, + "grpc" => Field::Key_grpc, + "httpGet" => Field::Key_http_get, + "initialDelaySeconds" => Field::Key_initial_delay_seconds, + "periodSeconds" => Field::Key_period_seconds, + "successThreshold" => Field::Key_success_threshold, + "tcpSocket" => Field::Key_tcp_socket, + "terminationGracePeriodSeconds" => Field::Key_termination_grace_period_seconds, + "timeoutSeconds" => Field::Key_timeout_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Probe; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Probe") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exec: Option = None; + let mut value_failure_threshold: Option = None; + let mut value_grpc: Option = None; + let mut value_http_get: Option = None; + let mut value_initial_delay_seconds: Option = None; + let mut value_period_seconds: Option = None; + let mut value_success_threshold: Option = None; + let mut value_tcp_socket: Option = None; + let mut value_termination_grace_period_seconds: Option = None; + let mut value_timeout_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exec => value_exec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_failure_threshold => value_failure_threshold = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_grpc => value_grpc = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_http_get => value_http_get = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_initial_delay_seconds => value_initial_delay_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_period_seconds => value_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_success_threshold => value_success_threshold = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tcp_socket => value_tcp_socket = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_termination_grace_period_seconds => value_termination_grace_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_timeout_seconds => value_timeout_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Probe { + exec: value_exec, + failure_threshold: value_failure_threshold, + grpc: value_grpc, + http_get: value_http_get, + initial_delay_seconds: value_initial_delay_seconds, + period_seconds: value_period_seconds, + success_threshold: value_success_threshold, + tcp_socket: value_tcp_socket, + termination_grace_period_seconds: value_termination_grace_period_seconds, + timeout_seconds: value_timeout_seconds, + }) + } + } + + deserializer.deserialize_struct( + "Probe", + &[ + "exec", + "failureThreshold", + "grpc", + "httpGet", + "initialDelaySeconds", + "periodSeconds", + "successThreshold", + "tcpSocket", + "terminationGracePeriodSeconds", + "timeoutSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Probe { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Probe", + self.exec.as_ref().map_or(0, |_| 1) + + self.failure_threshold.as_ref().map_or(0, |_| 1) + + self.grpc.as_ref().map_or(0, |_| 1) + + self.http_get.as_ref().map_or(0, |_| 1) + + self.initial_delay_seconds.as_ref().map_or(0, |_| 1) + + self.period_seconds.as_ref().map_or(0, |_| 1) + + self.success_threshold.as_ref().map_or(0, |_| 1) + + self.tcp_socket.as_ref().map_or(0, |_| 1) + + self.termination_grace_period_seconds.as_ref().map_or(0, |_| 1) + + self.timeout_seconds.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exec", value)?; + } + if let Some(value) = &self.failure_threshold { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "failureThreshold", value)?; + } + if let Some(value) = &self.grpc { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "grpc", value)?; + } + if let Some(value) = &self.http_get { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "httpGet", value)?; + } + if let Some(value) = &self.initial_delay_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "initialDelaySeconds", value)?; + } + if let Some(value) = &self.period_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "periodSeconds", value)?; + } + if let Some(value) = &self.success_threshold { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "successThreshold", value)?; + } + if let Some(value) = &self.tcp_socket { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tcpSocket", value)?; + } + if let Some(value) = &self.termination_grace_period_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminationGracePeriodSeconds", value)?; + } + if let Some(value) = &self.timeout_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeoutSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Probe { + fn schema_name() -> String { + "io.k8s.api.core.v1.Probe".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "exec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Exec specifies the action to take.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "failureThreshold".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "grpc".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GRPC specifies an action involving a GRPC port.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "httpGet".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPGet specifies the http request to perform.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "initialDelaySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "periodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "successThreshold".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "tcpSocket".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TCPSocket specifies an action involving a TCP port.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "terminationGracePeriodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "timeoutSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/projected_volume_source.rs b/src/v1_30/api/core/v1/projected_volume_source.rs new file mode 100644 index 000000000..676638445 --- /dev/null +++ b/src/v1_30/api/core/v1/projected_volume_source.rs @@ -0,0 +1,157 @@ +// Generated from definition io.k8s.api.core.v1.ProjectedVolumeSource + +/// Represents a projected volume source +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ProjectedVolumeSource { + /// defaultMode are the mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub default_mode: Option, + + /// sources is the list of volume projections + pub sources: Option>, +} + +impl crate::DeepMerge for ProjectedVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.default_mode, other.default_mode); + crate::merge_strategies::list::atomic(&mut self.sources, other.sources); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ProjectedVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default_mode, + Key_sources, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "defaultMode" => Field::Key_default_mode, + "sources" => Field::Key_sources, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ProjectedVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ProjectedVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default_mode: Option = None; + let mut value_sources: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default_mode => value_default_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_sources => value_sources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ProjectedVolumeSource { + default_mode: value_default_mode, + sources: value_sources, + }) + } + } + + deserializer.deserialize_struct( + "ProjectedVolumeSource", + &[ + "defaultMode", + "sources", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ProjectedVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ProjectedVolumeSource", + self.default_mode.as_ref().map_or(0, |_| 1) + + self.sources.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultMode", value)?; + } + if let Some(value) = &self.sources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sources", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ProjectedVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ProjectedVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a projected volume source".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "defaultMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("defaultMode are the mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "sources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("sources is the list of volume projections".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/quobyte_volume_source.rs b/src/v1_30/api/core/v1/quobyte_volume_source.rs new file mode 100644 index 000000000..a5aa208eb --- /dev/null +++ b/src/v1_30/api/core/v1/quobyte_volume_source.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.api.core.v1.QuobyteVolumeSource + +/// Represents a Quobyte mount that lasts the lifetime of a pod. Quobyte volumes do not support ownership management or SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct QuobyteVolumeSource { + /// group to map volume access to Default is no group + pub group: Option, + + /// readOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false. + pub read_only: Option, + + /// registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes + pub registry: String, + + /// tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin + pub tenant: Option, + + /// user to map volume access to Defaults to serivceaccount user + pub user: Option, + + /// volume is a string that references an already created Quobyte volume by name. + pub volume: String, +} + +impl crate::DeepMerge for QuobyteVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.registry, other.registry); + crate::DeepMerge::merge_from(&mut self.tenant, other.tenant); + crate::DeepMerge::merge_from(&mut self.user, other.user); + crate::DeepMerge::merge_from(&mut self.volume, other.volume); + } +} + +impl<'de> crate::serde::Deserialize<'de> for QuobyteVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_read_only, + Key_registry, + Key_tenant, + Key_user, + Key_volume, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "readOnly" => Field::Key_read_only, + "registry" => Field::Key_registry, + "tenant" => Field::Key_tenant, + "user" => Field::Key_user, + "volume" => Field::Key_volume, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = QuobyteVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("QuobyteVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_read_only: Option = None; + let mut value_registry: Option = None; + let mut value_tenant: Option = None; + let mut value_user: Option = None; + let mut value_volume: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_registry => value_registry = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tenant => value_tenant = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume => value_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(QuobyteVolumeSource { + group: value_group, + read_only: value_read_only, + registry: value_registry.unwrap_or_default(), + tenant: value_tenant, + user: value_user, + volume: value_volume.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "QuobyteVolumeSource", + &[ + "group", + "readOnly", + "registry", + "tenant", + "user", + "volume", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for QuobyteVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "QuobyteVolumeSource", + 2 + + self.group.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.tenant.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "registry", &self.registry)?; + if let Some(value) = &self.tenant { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tenant", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volume", &self.volume)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for QuobyteVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.QuobyteVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Quobyte mount that lasts the lifetime of a pod. Quobyte volumes do not support ownership management or SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("group to map volume access to Default is no group".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "registry".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "tenant".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("user to map volume access to Defaults to serivceaccount user".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volume".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volume is a string that references an already created Quobyte volume by name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "registry".to_owned(), + "volume".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/rbd_persistent_volume_source.rs b/src/v1_30/api/core/v1/rbd_persistent_volume_source.rs new file mode 100644 index 000000000..08d130804 --- /dev/null +++ b/src/v1_30/api/core/v1/rbd_persistent_volume_source.rs @@ -0,0 +1,310 @@ +// Generated from definition io.k8s.api.core.v1.RBDPersistentVolumeSource + +/// Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RBDPersistentVolumeSource { + /// fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + pub fs_type: Option, + + /// image is the rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub image: String, + + /// keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub keyring: Option, + + /// monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub monitors: Vec, + + /// pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub pool: Option, + + /// readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub read_only: Option, + + /// secretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub secret_ref: Option, + + /// user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub user: Option, +} + +impl crate::DeepMerge for RBDPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.image, other.image); + crate::DeepMerge::merge_from(&mut self.keyring, other.keyring); + crate::merge_strategies::list::atomic(&mut self.monitors, other.monitors); + crate::DeepMerge::merge_from(&mut self.pool, other.pool); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RBDPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_image, + Key_keyring, + Key_monitors, + Key_pool, + Key_read_only, + Key_secret_ref, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "image" => Field::Key_image, + "keyring" => Field::Key_keyring, + "monitors" => Field::Key_monitors, + "pool" => Field::Key_pool, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RBDPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RBDPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_image: Option = None; + let mut value_keyring: Option = None; + let mut value_monitors: Option> = None; + let mut value_pool: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_keyring => value_keyring = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_monitors => value_monitors = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pool => value_pool = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RBDPersistentVolumeSource { + fs_type: value_fs_type, + image: value_image.unwrap_or_default(), + keyring: value_keyring, + monitors: value_monitors.unwrap_or_default(), + pool: value_pool, + read_only: value_read_only, + secret_ref: value_secret_ref, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "RBDPersistentVolumeSource", + &[ + "fsType", + "image", + "keyring", + "monitors", + "pool", + "readOnly", + "secretRef", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RBDPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RBDPersistentVolumeSource", + 2 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.keyring.as_ref().map_or(0, |_| 1) + + self.pool.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", &self.image)?; + if let Some(value) = &self.keyring { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "keyring", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "monitors", &self.monitors)?; + if let Some(value) = &self.pool { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pool", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RBDPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.RBDPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("image is the rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "keyring".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "monitors".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "pool".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "image".to_owned(), + "monitors".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/rbd_volume_source.rs b/src/v1_30/api/core/v1/rbd_volume_source.rs new file mode 100644 index 000000000..18a2d2c01 --- /dev/null +++ b/src/v1_30/api/core/v1/rbd_volume_source.rs @@ -0,0 +1,310 @@ +// Generated from definition io.k8s.api.core.v1.RBDVolumeSource + +/// Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RBDVolumeSource { + /// fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + pub fs_type: Option, + + /// image is the rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub image: String, + + /// keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub keyring: Option, + + /// monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub monitors: Vec, + + /// pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub pool: Option, + + /// readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub read_only: Option, + + /// secretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub secret_ref: Option, + + /// user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + pub user: Option, +} + +impl crate::DeepMerge for RBDVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.image, other.image); + crate::DeepMerge::merge_from(&mut self.keyring, other.keyring); + crate::merge_strategies::list::atomic(&mut self.monitors, other.monitors); + crate::DeepMerge::merge_from(&mut self.pool, other.pool); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RBDVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_image, + Key_keyring, + Key_monitors, + Key_pool, + Key_read_only, + Key_secret_ref, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "image" => Field::Key_image, + "keyring" => Field::Key_keyring, + "monitors" => Field::Key_monitors, + "pool" => Field::Key_pool, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RBDVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RBDVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_image: Option = None; + let mut value_keyring: Option = None; + let mut value_monitors: Option> = None; + let mut value_pool: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_keyring => value_keyring = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_monitors => value_monitors = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pool => value_pool = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RBDVolumeSource { + fs_type: value_fs_type, + image: value_image.unwrap_or_default(), + keyring: value_keyring, + monitors: value_monitors.unwrap_or_default(), + pool: value_pool, + read_only: value_read_only, + secret_ref: value_secret_ref, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "RBDVolumeSource", + &[ + "fsType", + "image", + "keyring", + "monitors", + "pool", + "readOnly", + "secretRef", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RBDVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RBDVolumeSource", + 2 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.keyring.as_ref().map_or(0, |_| 1) + + self.pool.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", &self.image)?; + if let Some(value) = &self.keyring { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "keyring", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "monitors", &self.monitors)?; + if let Some(value) = &self.pool { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pool", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RBDVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.RBDVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "image".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("image is the rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "keyring".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "monitors".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "pool".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "image".to_owned(), + "monitors".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/replication_controller.rs b/src/v1_30/api/core/v1/replication_controller.rs new file mode 100644 index 000000000..a84e2c968 --- /dev/null +++ b/src/v1_30/api/core/v1/replication_controller.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.ReplicationController + +/// ReplicationController represents the configuration of a replication controller. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicationController { + /// If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the specification of the desired behavior of the replication controller. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Status is the most recently observed status of the replication controller. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for ReplicationController { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "ReplicationController"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "replicationcontrollers"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ReplicationController { + const LIST_KIND: &'static str = "ReplicationControllerList"; +} + +impl crate::Metadata for ReplicationController { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ReplicationController { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicationController { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicationController; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicationController { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicationController { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicationController { + fn schema_name() -> String { + "io.k8s.api.core.v1.ReplicationController".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicationController represents the configuration of a replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the specification of the desired behavior of the replication controller. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is the most recently observed status of the replication controller. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/replication_controller_condition.rs b/src/v1_30/api/core/v1/replication_controller_condition.rs new file mode 100644 index 000000000..1686b2e4f --- /dev/null +++ b/src/v1_30/api/core/v1/replication_controller_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.core.v1.ReplicationControllerCondition + +/// ReplicationControllerCondition describes the state of a replication controller at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicationControllerCondition { + /// The last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of replication controller condition. + pub type_: String, +} + +impl crate::DeepMerge for ReplicationControllerCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicationControllerCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicationControllerCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicationControllerCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicationControllerCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ReplicationControllerCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicationControllerCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicationControllerCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicationControllerCondition { + fn schema_name() -> String { + "io.k8s.api.core.v1.ReplicationControllerCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicationControllerCondition describes the state of a replication controller at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of replication controller condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/replication_controller_spec.rs b/src/v1_30/api/core/v1/replication_controller_spec.rs new file mode 100644 index 000000000..0ff2d5644 --- /dev/null +++ b/src/v1_30/api/core/v1/replication_controller_spec.rs @@ -0,0 +1,213 @@ +// Generated from definition io.k8s.api.core.v1.ReplicationControllerSpec + +/// ReplicationControllerSpec is the specification of a replication controller. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicationControllerSpec { + /// Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready) + pub min_ready_seconds: Option, + + /// Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + pub replicas: Option, + + /// Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + pub selector: Option>, + + /// Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. The only allowed template.spec.restartPolicy value is "Always". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template + pub template: Option, +} + +impl crate::DeepMerge for ReplicationControllerSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.min_ready_seconds, other.min_ready_seconds); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + crate::merge_strategies::map::atomic(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.template, other.template); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicationControllerSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_min_ready_seconds, + Key_replicas, + Key_selector, + Key_template, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "minReadySeconds" => Field::Key_min_ready_seconds, + "replicas" => Field::Key_replicas, + "selector" => Field::Key_selector, + "template" => Field::Key_template, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicationControllerSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicationControllerSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_min_ready_seconds: Option = None; + let mut value_replicas: Option = None; + let mut value_selector: Option> = None; + let mut value_template: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_min_ready_seconds => value_min_ready_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_template => value_template = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicationControllerSpec { + min_ready_seconds: value_min_ready_seconds, + replicas: value_replicas, + selector: value_selector, + template: value_template, + }) + } + } + + deserializer.deserialize_struct( + "ReplicationControllerSpec", + &[ + "minReadySeconds", + "replicas", + "selector", + "template", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicationControllerSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicationControllerSpec", + self.min_ready_seconds.as_ref().map_or(0, |_| 1) + + self.replicas.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1) + + self.template.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.min_ready_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minReadySeconds", value)?; + } + if let Some(value) = &self.replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + if let Some(value) = &self.template { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "template", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicationControllerSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.ReplicationControllerSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicationControllerSpec is the specification of a replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "minReadySeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "template".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. The only allowed template.spec.restartPolicy value is \"Always\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/replication_controller_status.rs b/src/v1_30/api/core/v1/replication_controller_status.rs new file mode 100644 index 000000000..38dba200a --- /dev/null +++ b/src/v1_30/api/core/v1/replication_controller_status.rs @@ -0,0 +1,269 @@ +// Generated from definition io.k8s.api.core.v1.ReplicationControllerStatus + +/// ReplicationControllerStatus represents the current status of a replication controller. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ReplicationControllerStatus { + /// The number of available replicas (ready for at least minReadySeconds) for this replication controller. + pub available_replicas: Option, + + /// Represents the latest available observations of a replication controller's current state. + pub conditions: Option>, + + /// The number of pods that have labels matching the labels of the pod template of the replication controller. + pub fully_labeled_replicas: Option, + + /// ObservedGeneration reflects the generation of the most recently observed replication controller. + pub observed_generation: Option, + + /// The number of ready replicas for this replication controller. + pub ready_replicas: Option, + + /// Replicas is the most recently observed number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller + pub replicas: i32, +} + +impl crate::DeepMerge for ReplicationControllerStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.available_replicas, other.available_replicas); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.fully_labeled_replicas, other.fully_labeled_replicas); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.ready_replicas, other.ready_replicas); + crate::DeepMerge::merge_from(&mut self.replicas, other.replicas); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ReplicationControllerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_available_replicas, + Key_conditions, + Key_fully_labeled_replicas, + Key_observed_generation, + Key_ready_replicas, + Key_replicas, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "availableReplicas" => Field::Key_available_replicas, + "conditions" => Field::Key_conditions, + "fullyLabeledReplicas" => Field::Key_fully_labeled_replicas, + "observedGeneration" => Field::Key_observed_generation, + "readyReplicas" => Field::Key_ready_replicas, + "replicas" => Field::Key_replicas, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ReplicationControllerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ReplicationControllerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_available_replicas: Option = None; + let mut value_conditions: Option> = None; + let mut value_fully_labeled_replicas: Option = None; + let mut value_observed_generation: Option = None; + let mut value_ready_replicas: Option = None; + let mut value_replicas: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_available_replicas => value_available_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fully_labeled_replicas => value_fully_labeled_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ready_replicas => value_ready_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_replicas => value_replicas = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ReplicationControllerStatus { + available_replicas: value_available_replicas, + conditions: value_conditions, + fully_labeled_replicas: value_fully_labeled_replicas, + observed_generation: value_observed_generation, + ready_replicas: value_ready_replicas, + replicas: value_replicas.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ReplicationControllerStatus", + &[ + "availableReplicas", + "conditions", + "fullyLabeledReplicas", + "observedGeneration", + "readyReplicas", + "replicas", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ReplicationControllerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ReplicationControllerStatus", + 1 + + self.available_replicas.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.fully_labeled_replicas.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1) + + self.ready_replicas.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.available_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "availableReplicas", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.fully_labeled_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fullyLabeledReplicas", value)?; + } + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + if let Some(value) = &self.ready_replicas { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readyReplicas", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "replicas", &self.replicas)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ReplicationControllerStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ReplicationControllerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReplicationControllerStatus represents the current status of a replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "availableReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of available replicas (ready for at least minReadySeconds) for this replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents the latest available observations of a replication controller's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "fullyLabeledReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of pods that have labels matching the labels of the pod template of the replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObservedGeneration reflects the generation of the most recently observed replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "readyReplicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The number of ready replicas for this replication controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "replicas".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Replicas is the most recently observed number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "replicas".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_claim.rs b/src/v1_30/api/core/v1/resource_claim.rs new file mode 100644 index 000000000..ea0e350cb --- /dev/null +++ b/src/v1_30/api/core/v1/resource_claim.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.core.v1.ResourceClaim + +/// ResourceClaim references one entry in PodSpec.ResourceClaims. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaim { + /// Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container. + pub name: String, +} + +impl crate::DeepMerge for ResourceClaim { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaim { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaim; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaim") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaim { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaim", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaim { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaim", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaim { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceClaim".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaim references one entry in PodSpec.ResourceClaims.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_field_selector.rs b/src/v1_30/api/core/v1/resource_field_selector.rs new file mode 100644 index 000000000..c2ca6d15b --- /dev/null +++ b/src/v1_30/api/core/v1/resource_field_selector.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.core.v1.ResourceFieldSelector + +/// ResourceFieldSelector represents container resources (cpu, memory) and their output format +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceFieldSelector { + /// Container name: required for volumes, optional for env vars + pub container_name: Option, + + /// Specifies the output format of the exposed resources, defaults to "1" + pub divisor: Option, + + /// Required: resource to select + pub resource: String, +} + +impl crate::DeepMerge for ResourceFieldSelector { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.container_name, other.container_name); + crate::DeepMerge::merge_from(&mut self.divisor, other.divisor); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceFieldSelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_container_name, + Key_divisor, + Key_resource, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "containerName" => Field::Key_container_name, + "divisor" => Field::Key_divisor, + "resource" => Field::Key_resource, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceFieldSelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceFieldSelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_container_name: Option = None; + let mut value_divisor: Option = None; + let mut value_resource: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_container_name => value_container_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_divisor => value_divisor = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceFieldSelector { + container_name: value_container_name, + divisor: value_divisor, + resource: value_resource.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceFieldSelector", + &[ + "containerName", + "divisor", + "resource", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceFieldSelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceFieldSelector", + 1 + + self.container_name.as_ref().map_or(0, |_| 1) + + self.divisor.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.container_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "containerName", value)?; + } + if let Some(value) = &self.divisor { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "divisor", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", &self.resource)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceFieldSelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceFieldSelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceFieldSelector represents container resources (cpu, memory) and their output format".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "containerName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Container name: required for volumes, optional for env vars".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "divisor".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the output format of the exposed resources, defaults to \"1\"".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required: resource to select".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "resource".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_quota.rs b/src/v1_30/api/core/v1/resource_quota.rs new file mode 100644 index 000000000..995029212 --- /dev/null +++ b/src/v1_30/api/core/v1/resource_quota.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.ResourceQuota + +/// ResourceQuota sets aggregate quota restrictions enforced per namespace +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceQuota { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the desired quota. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Status defines the actual enforced quota and its current usage. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for ResourceQuota { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "ResourceQuota"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "resourcequotas"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ResourceQuota { + const LIST_KIND: &'static str = "ResourceQuotaList"; +} + +impl crate::Metadata for ResourceQuota { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceQuota { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceQuota { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceQuota; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceQuota { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceQuota { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceQuota { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceQuota".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceQuota sets aggregate quota restrictions enforced per namespace".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the desired quota. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status defines the actual enforced quota and its current usage. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_quota_spec.rs b/src/v1_30/api/core/v1/resource_quota_spec.rs new file mode 100644 index 000000000..3468d8e9e --- /dev/null +++ b/src/v1_30/api/core/v1/resource_quota_spec.rs @@ -0,0 +1,192 @@ +// Generated from definition io.k8s.api.core.v1.ResourceQuotaSpec + +/// ResourceQuotaSpec defines the desired hard limits to enforce for Quota. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceQuotaSpec { + /// hard is the set of desired hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + pub hard: Option>, + + /// scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched. + pub scope_selector: Option, + + /// A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects. + pub scopes: Option>, +} + +impl crate::DeepMerge for ResourceQuotaSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.hard, other.hard, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.scope_selector, other.scope_selector); + crate::merge_strategies::list::atomic(&mut self.scopes, other.scopes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceQuotaSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hard, + Key_scope_selector, + Key_scopes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hard" => Field::Key_hard, + "scopeSelector" => Field::Key_scope_selector, + "scopes" => Field::Key_scopes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceQuotaSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceQuotaSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hard: Option> = None; + let mut value_scope_selector: Option = None; + let mut value_scopes: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hard => value_hard = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope_selector => value_scope_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scopes => value_scopes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceQuotaSpec { + hard: value_hard, + scope_selector: value_scope_selector, + scopes: value_scopes, + }) + } + } + + deserializer.deserialize_struct( + "ResourceQuotaSpec", + &[ + "hard", + "scopeSelector", + "scopes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceQuotaSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceQuotaSpec", + self.hard.as_ref().map_or(0, |_| 1) + + self.scope_selector.as_ref().map_or(0, |_| 1) + + self.scopes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hard { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hard", value)?; + } + if let Some(value) = &self.scope_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scopeSelector", value)?; + } + if let Some(value) = &self.scopes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scopes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceQuotaSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceQuotaSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceQuotaSpec defines the desired hard limits to enforce for Quota.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hard".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hard is the set of desired hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "scopeSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scopes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_quota_status.rs b/src/v1_30/api/core/v1/resource_quota_status.rs new file mode 100644 index 000000000..74ee1efe3 --- /dev/null +++ b/src/v1_30/api/core/v1/resource_quota_status.rs @@ -0,0 +1,164 @@ +// Generated from definition io.k8s.api.core.v1.ResourceQuotaStatus + +/// ResourceQuotaStatus defines the enforced hard limits and observed use. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceQuotaStatus { + /// Hard is the set of enforced hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ + pub hard: Option>, + + /// Used is the current observed total usage of the resource in the namespace. + pub used: Option>, +} + +impl crate::DeepMerge for ResourceQuotaStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.hard, other.hard, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.used, other.used, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceQuotaStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hard, + Key_used, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hard" => Field::Key_hard, + "used" => Field::Key_used, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceQuotaStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceQuotaStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hard: Option> = None; + let mut value_used: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hard => value_hard = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_used => value_used = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceQuotaStatus { + hard: value_hard, + used: value_used, + }) + } + } + + deserializer.deserialize_struct( + "ResourceQuotaStatus", + &[ + "hard", + "used", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceQuotaStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceQuotaStatus", + self.hard.as_ref().map_or(0, |_| 1) + + self.used.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hard { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hard", value)?; + } + if let Some(value) = &self.used { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "used", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceQuotaStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceQuotaStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceQuotaStatus defines the enforced hard limits and observed use.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hard".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Hard is the set of enforced hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "used".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Used is the current observed total usage of the resource in the namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/resource_requirements.rs b/src/v1_30/api/core/v1/resource_requirements.rs new file mode 100644 index 000000000..5df4735a6 --- /dev/null +++ b/src/v1_30/api/core/v1/resource_requirements.rs @@ -0,0 +1,204 @@ +// Generated from definition io.k8s.api.core.v1.ResourceRequirements + +/// ResourceRequirements describes the compute resource requirements. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceRequirements { + /// Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. + /// + /// This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. + /// + /// This field is immutable. It can only be set for containers. + pub claims: Option>, + + /// Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub limits: Option>, + + /// Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub requests: Option>, +} + +impl crate::DeepMerge for ResourceRequirements { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.claims, + other.claims, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::map::granular(&mut self.limits, other.limits, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.requests, other.requests, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceRequirements { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_claims, + Key_limits, + Key_requests, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "claims" => Field::Key_claims, + "limits" => Field::Key_limits, + "requests" => Field::Key_requests, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceRequirements; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceRequirements") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_claims: Option> = None; + let mut value_limits: Option> = None; + let mut value_requests: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_claims => value_claims = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limits => value_limits = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_requests => value_requests = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceRequirements { + claims: value_claims, + limits: value_limits, + requests: value_requests, + }) + } + } + + deserializer.deserialize_struct( + "ResourceRequirements", + &[ + "claims", + "limits", + "requests", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceRequirements { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceRequirements", + self.claims.as_ref().map_or(0, |_| 1) + + self.limits.as_ref().map_or(0, |_| 1) + + self.requests.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.claims { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "claims", value)?; + } + if let Some(value) = &self.limits { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limits", value)?; + } + if let Some(value) = &self.requests { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requests", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceRequirements { + fn schema_name() -> String { + "io.k8s.api.core.v1.ResourceRequirements".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRequirements describes the compute resource requirements.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "claims".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable. It can only be set for containers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "limits".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "requests".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/scale_io_persistent_volume_source.rs b/src/v1_30/api/core/v1/scale_io_persistent_volume_source.rs new file mode 100644 index 000000000..c55a4d599 --- /dev/null +++ b/src/v1_30/api/core/v1/scale_io_persistent_volume_source.rs @@ -0,0 +1,349 @@ +// Generated from definition io.k8s.api.core.v1.ScaleIOPersistentVolumeSource + +/// ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScaleIOPersistentVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs" + pub fs_type: Option, + + /// gateway is the host address of the ScaleIO API Gateway. + pub gateway: String, + + /// protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + pub protection_domain: Option, + + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail. + pub secret_ref: crate::api::core::v1::SecretReference, + + /// sslEnabled is the flag to enable/disable SSL communication with Gateway, default false + pub ssl_enabled: Option, + + /// storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. + pub storage_mode: Option, + + /// storagePool is the ScaleIO Storage Pool associated with the protection domain. + pub storage_pool: Option, + + /// system is the name of the storage system as configured in ScaleIO. + pub system: String, + + /// volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source. + pub volume_name: Option, +} + +impl crate::DeepMerge for ScaleIOPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.gateway, other.gateway); + crate::DeepMerge::merge_from(&mut self.protection_domain, other.protection_domain); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.ssl_enabled, other.ssl_enabled); + crate::DeepMerge::merge_from(&mut self.storage_mode, other.storage_mode); + crate::DeepMerge::merge_from(&mut self.storage_pool, other.storage_pool); + crate::DeepMerge::merge_from(&mut self.system, other.system); + crate::DeepMerge::merge_from(&mut self.volume_name, other.volume_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScaleIOPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_gateway, + Key_protection_domain, + Key_read_only, + Key_secret_ref, + Key_ssl_enabled, + Key_storage_mode, + Key_storage_pool, + Key_system, + Key_volume_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "gateway" => Field::Key_gateway, + "protectionDomain" => Field::Key_protection_domain, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "sslEnabled" => Field::Key_ssl_enabled, + "storageMode" => Field::Key_storage_mode, + "storagePool" => Field::Key_storage_pool, + "system" => Field::Key_system, + "volumeName" => Field::Key_volume_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScaleIOPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScaleIOPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_gateway: Option = None; + let mut value_protection_domain: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_ssl_enabled: Option = None; + let mut value_storage_mode: Option = None; + let mut value_storage_pool: Option = None; + let mut value_system: Option = None; + let mut value_volume_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_gateway => value_gateway = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protection_domain => value_protection_domain = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ssl_enabled => value_ssl_enabled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_mode => value_storage_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_pool => value_storage_pool = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_system => value_system = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_name => value_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScaleIOPersistentVolumeSource { + fs_type: value_fs_type, + gateway: value_gateway.unwrap_or_default(), + protection_domain: value_protection_domain, + read_only: value_read_only, + secret_ref: value_secret_ref.unwrap_or_default(), + ssl_enabled: value_ssl_enabled, + storage_mode: value_storage_mode, + storage_pool: value_storage_pool, + system: value_system.unwrap_or_default(), + volume_name: value_volume_name, + }) + } + } + + deserializer.deserialize_struct( + "ScaleIOPersistentVolumeSource", + &[ + "fsType", + "gateway", + "protectionDomain", + "readOnly", + "secretRef", + "sslEnabled", + "storageMode", + "storagePool", + "system", + "volumeName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScaleIOPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScaleIOPersistentVolumeSource", + 3 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.protection_domain.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.ssl_enabled.as_ref().map_or(0, |_| 1) + + self.storage_mode.as_ref().map_or(0, |_| 1) + + self.storage_pool.as_ref().map_or(0, |_| 1) + + self.volume_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gateway", &self.gateway)?; + if let Some(value) = &self.protection_domain { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protectionDomain", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", &self.secret_ref)?; + if let Some(value) = &self.ssl_enabled { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sslEnabled", value)?; + } + if let Some(value) = &self.storage_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageMode", value)?; + } + if let Some(value) = &self.storage_pool { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storagePool", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "system", &self.system)?; + if let Some(value) = &self.volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScaleIOPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ScaleIOPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gateway".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("gateway is the host address of the ScaleIO API Gateway.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "protectionDomain".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("protectionDomain is the name of the ScaleIO Protection Domain for the configured storage.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "sslEnabled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("sslEnabled is the flag to enable/disable SSL communication with Gateway, default false".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "storageMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storagePool".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storagePool is the ScaleIO Storage Pool associated with the protection domain.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "system".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("system is the name of the storage system as configured in ScaleIO.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "gateway".to_owned(), + "secretRef".to_owned(), + "system".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/scale_io_volume_source.rs b/src/v1_30/api/core/v1/scale_io_volume_source.rs new file mode 100644 index 000000000..1729f3869 --- /dev/null +++ b/src/v1_30/api/core/v1/scale_io_volume_source.rs @@ -0,0 +1,349 @@ +// Generated from definition io.k8s.api.core.v1.ScaleIOVolumeSource + +/// ScaleIOVolumeSource represents a persistent ScaleIO volume +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScaleIOVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs". + pub fs_type: Option, + + /// gateway is the host address of the ScaleIO API Gateway. + pub gateway: String, + + /// protectionDomain is the name of the ScaleIO Protection Domain for the configured storage. + pub protection_domain: Option, + + /// readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail. + pub secret_ref: crate::api::core::v1::LocalObjectReference, + + /// sslEnabled Flag enable/disable SSL communication with Gateway, default false + pub ssl_enabled: Option, + + /// storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. + pub storage_mode: Option, + + /// storagePool is the ScaleIO Storage Pool associated with the protection domain. + pub storage_pool: Option, + + /// system is the name of the storage system as configured in ScaleIO. + pub system: String, + + /// volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source. + pub volume_name: Option, +} + +impl crate::DeepMerge for ScaleIOVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.gateway, other.gateway); + crate::DeepMerge::merge_from(&mut self.protection_domain, other.protection_domain); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.ssl_enabled, other.ssl_enabled); + crate::DeepMerge::merge_from(&mut self.storage_mode, other.storage_mode); + crate::DeepMerge::merge_from(&mut self.storage_pool, other.storage_pool); + crate::DeepMerge::merge_from(&mut self.system, other.system); + crate::DeepMerge::merge_from(&mut self.volume_name, other.volume_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScaleIOVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_gateway, + Key_protection_domain, + Key_read_only, + Key_secret_ref, + Key_ssl_enabled, + Key_storage_mode, + Key_storage_pool, + Key_system, + Key_volume_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "gateway" => Field::Key_gateway, + "protectionDomain" => Field::Key_protection_domain, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "sslEnabled" => Field::Key_ssl_enabled, + "storageMode" => Field::Key_storage_mode, + "storagePool" => Field::Key_storage_pool, + "system" => Field::Key_system, + "volumeName" => Field::Key_volume_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScaleIOVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScaleIOVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_gateway: Option = None; + let mut value_protection_domain: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_ssl_enabled: Option = None; + let mut value_storage_mode: Option = None; + let mut value_storage_pool: Option = None; + let mut value_system: Option = None; + let mut value_volume_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_gateway => value_gateway = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protection_domain => value_protection_domain = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ssl_enabled => value_ssl_enabled = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_mode => value_storage_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_pool => value_storage_pool = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_system => value_system = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_name => value_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScaleIOVolumeSource { + fs_type: value_fs_type, + gateway: value_gateway.unwrap_or_default(), + protection_domain: value_protection_domain, + read_only: value_read_only, + secret_ref: value_secret_ref.unwrap_or_default(), + ssl_enabled: value_ssl_enabled, + storage_mode: value_storage_mode, + storage_pool: value_storage_pool, + system: value_system.unwrap_or_default(), + volume_name: value_volume_name, + }) + } + } + + deserializer.deserialize_struct( + "ScaleIOVolumeSource", + &[ + "fsType", + "gateway", + "protectionDomain", + "readOnly", + "secretRef", + "sslEnabled", + "storageMode", + "storagePool", + "system", + "volumeName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScaleIOVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScaleIOVolumeSource", + 3 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.protection_domain.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.ssl_enabled.as_ref().map_or(0, |_| 1) + + self.storage_mode.as_ref().map_or(0, |_| 1) + + self.storage_pool.as_ref().map_or(0, |_| 1) + + self.volume_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gateway", &self.gateway)?; + if let Some(value) = &self.protection_domain { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protectionDomain", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", &self.secret_ref)?; + if let Some(value) = &self.ssl_enabled { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sslEnabled", value)?; + } + if let Some(value) = &self.storage_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageMode", value)?; + } + if let Some(value) = &self.storage_pool { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storagePool", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "system", &self.system)?; + if let Some(value) = &self.volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScaleIOVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.ScaleIOVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ScaleIOVolumeSource represents a persistent ScaleIO volume".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gateway".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("gateway is the host address of the ScaleIO API Gateway.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "protectionDomain".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("protectionDomain is the name of the ScaleIO Protection Domain for the configured storage.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "sslEnabled".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("sslEnabled Flag enable/disable SSL communication with Gateway, default false".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "storageMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storagePool".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storagePool is the ScaleIO Storage Pool associated with the protection domain.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "system".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("system is the name of the storage system as configured in ScaleIO.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "gateway".to_owned(), + "secretRef".to_owned(), + "system".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/scope_selector.rs b/src/v1_30/api/core/v1/scope_selector.rs new file mode 100644 index 000000000..23ebdb061 --- /dev/null +++ b/src/v1_30/api/core/v1/scope_selector.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.core.v1.ScopeSelector + +/// A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScopeSelector { + /// A list of scope selector requirements by scope of the resources. + pub match_expressions: Option>, +} + +impl crate::DeepMerge for ScopeSelector { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.match_expressions, other.match_expressions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScopeSelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_expressions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchExpressions" => Field::Key_match_expressions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScopeSelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScopeSelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_expressions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_expressions => value_match_expressions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScopeSelector { + match_expressions: value_match_expressions, + }) + } + } + + deserializer.deserialize_struct( + "ScopeSelector", + &[ + "matchExpressions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScopeSelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScopeSelector", + self.match_expressions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_expressions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchExpressions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScopeSelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.ScopeSelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchExpressions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of scope selector requirements by scope of the resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/scoped_resource_selector_requirement.rs b/src/v1_30/api/core/v1/scoped_resource_selector_requirement.rs new file mode 100644 index 000000000..ed818218b --- /dev/null +++ b/src/v1_30/api/core/v1/scoped_resource_selector_requirement.rs @@ -0,0 +1,185 @@ +// Generated from definition io.k8s.api.core.v1.ScopedResourceSelectorRequirement + +/// A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ScopedResourceSelectorRequirement { + /// Represents a scope's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. + pub operator: String, + + /// The name of the scope that the selector applies to. + pub scope_name: String, + + /// An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + pub values: Option>, +} + +impl crate::DeepMerge for ScopedResourceSelectorRequirement { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.operator, other.operator); + crate::DeepMerge::merge_from(&mut self.scope_name, other.scope_name); + crate::merge_strategies::list::atomic(&mut self.values, other.values); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ScopedResourceSelectorRequirement { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_operator, + Key_scope_name, + Key_values, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "operator" => Field::Key_operator, + "scopeName" => Field::Key_scope_name, + "values" => Field::Key_values, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ScopedResourceSelectorRequirement; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ScopedResourceSelectorRequirement") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_operator: Option = None; + let mut value_scope_name: Option = None; + let mut value_values: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_operator => value_operator = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope_name => value_scope_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_values => value_values = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ScopedResourceSelectorRequirement { + operator: value_operator.unwrap_or_default(), + scope_name: value_scope_name.unwrap_or_default(), + values: value_values, + }) + } + } + + deserializer.deserialize_struct( + "ScopedResourceSelectorRequirement", + &[ + "operator", + "scopeName", + "values", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ScopedResourceSelectorRequirement { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ScopedResourceSelectorRequirement", + 2 + + self.values.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operator", &self.operator)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scopeName", &self.scope_name)?; + if let Some(value) = &self.values { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "values", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ScopedResourceSelectorRequirement { + fn schema_name() -> String { + "io.k8s.api.core.v1.ScopedResourceSelectorRequirement".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "operator".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a scope's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "scopeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the scope that the selector applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "values".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "operator".to_owned(), + "scopeName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/se_linux_options.rs b/src/v1_30/api/core/v1/se_linux_options.rs new file mode 100644 index 000000000..2a4969159 --- /dev/null +++ b/src/v1_30/api/core/v1/se_linux_options.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.SELinuxOptions + +/// SELinuxOptions are the labels to be applied to the container +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SELinuxOptions { + /// Level is SELinux level label that applies to the container. + pub level: Option, + + /// Role is a SELinux role label that applies to the container. + pub role: Option, + + /// Type is a SELinux type label that applies to the container. + pub type_: Option, + + /// User is a SELinux user label that applies to the container. + pub user: Option, +} + +impl crate::DeepMerge for SELinuxOptions { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.level, other.level); + crate::DeepMerge::merge_from(&mut self.role, other.role); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SELinuxOptions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_level, + Key_role, + Key_type_, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "level" => Field::Key_level, + "role" => Field::Key_role, + "type" => Field::Key_type_, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SELinuxOptions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SELinuxOptions") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_level: Option = None; + let mut value_role: Option = None; + let mut value_type_: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_level => value_level = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_role => value_role = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SELinuxOptions { + level: value_level, + role: value_role, + type_: value_type_, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "SELinuxOptions", + &[ + "level", + "role", + "type", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SELinuxOptions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SELinuxOptions", + self.level.as_ref().map_or(0, |_| 1) + + self.role.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.level { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "level", value)?; + } + if let Some(value) = &self.role { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "role", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SELinuxOptions { + fn schema_name() -> String { + "io.k8s.api.core.v1.SELinuxOptions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SELinuxOptions are the labels to be applied to the container".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "level".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Level is SELinux level label that applies to the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "role".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Role is a SELinux role label that applies to the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type is a SELinux type label that applies to the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "user".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("User is a SELinux user label that applies to the container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/seccomp_profile.rs b/src/v1_30/api/core/v1/seccomp_profile.rs new file mode 100644 index 000000000..0a2a0ff63 --- /dev/null +++ b/src/v1_30/api/core/v1/seccomp_profile.rs @@ -0,0 +1,155 @@ +// Generated from definition io.k8s.api.core.v1.SeccompProfile + +/// SeccompProfile defines a pod/container's seccomp profile settings. Only one profile source may be set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SeccompProfile { + /// localhostProfile indicates a profile defined in a file on the node should be used. The profile must be preconfigured on the node to work. Must be a descending path, relative to the kubelet's configured seccomp profile location. Must be set if type is "Localhost". Must NOT be set for any other type. + pub localhost_profile: Option, + + /// type indicates which kind of seccomp profile will be applied. Valid options are: + /// + /// Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied. + pub type_: String, +} + +impl crate::DeepMerge for SeccompProfile { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.localhost_profile, other.localhost_profile); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SeccompProfile { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_localhost_profile, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "localhostProfile" => Field::Key_localhost_profile, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SeccompProfile; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SeccompProfile") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_localhost_profile: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_localhost_profile => value_localhost_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SeccompProfile { + localhost_profile: value_localhost_profile, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "SeccompProfile", + &[ + "localhostProfile", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SeccompProfile { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SeccompProfile", + 1 + + self.localhost_profile.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.localhost_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "localhostProfile", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SeccompProfile { + fn schema_name() -> String { + "io.k8s.api.core.v1.SeccompProfile".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SeccompProfile defines a pod/container's seccomp profile settings. Only one profile source may be set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "localhostProfile".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("localhostProfile indicates a profile defined in a file on the node should be used. The profile must be preconfigured on the node to work. Must be a descending path, relative to the kubelet's configured seccomp profile location. Must be set if type is \"Localhost\". Must NOT be set for any other type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type indicates which kind of seccomp profile will be applied. Valid options are:\n\nLocalhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret.rs b/src/v1_30/api/core/v1/secret.rs new file mode 100644 index 000000000..4c93df779 --- /dev/null +++ b/src/v1_30/api/core/v1/secret.rs @@ -0,0 +1,318 @@ +// Generated from definition io.k8s.api.core.v1.Secret + +/// Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Secret { + /// Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 + pub data: Option>, + + /// Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + pub immutable: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API. + pub string_data: Option>, + + /// Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types + pub type_: Option, +} + +impl crate::Resource for Secret { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Secret"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "secrets"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Secret { + const LIST_KIND: &'static str = "SecretList"; +} + +impl crate::Metadata for Secret { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Secret { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.data, other.data, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.immutable, other.immutable); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::map::granular(&mut self.string_data, other.string_data, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Secret { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_data, + Key_immutable, + Key_metadata, + Key_string_data, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "data" => Field::Key_data, + "immutable" => Field::Key_immutable, + "metadata" => Field::Key_metadata, + "stringData" => Field::Key_string_data, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Secret; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_data: Option> = None; + let mut value_immutable: Option = None; + let mut value_metadata: Option = None; + let mut value_string_data: Option> = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_data => value_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_immutable => value_immutable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_string_data => value_string_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Secret { + data: value_data, + immutable: value_immutable, + metadata: value_metadata.unwrap_or_default(), + string_data: value_string_data, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "data", + "immutable", + "metadata", + "stringData", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Secret { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.data.as_ref().map_or(0, |_| 1) + + self.immutable.as_ref().map_or(0, |_| 1) + + self.string_data.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "data", value)?; + } + if let Some(value) = &self.immutable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "immutable", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.string_data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stringData", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Secret { + fn schema_name() -> String { + "io.k8s.api.core.v1.Secret".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "data".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "immutable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "stringData".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret_env_source.rs b/src/v1_30/api/core/v1/secret_env_source.rs new file mode 100644 index 000000000..920f5519a --- /dev/null +++ b/src/v1_30/api/core/v1/secret_env_source.rs @@ -0,0 +1,154 @@ +// Generated from definition io.k8s.api.core.v1.SecretEnvSource + +/// SecretEnvSource selects a Secret to populate the environment variables with. +/// +/// The contents of the target Secret's Data field will represent the key-value pairs as environment variables. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecretEnvSource { + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// Specify whether the Secret must be defined + pub optional: Option, +} + +impl crate::DeepMerge for SecretEnvSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecretEnvSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecretEnvSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecretEnvSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecretEnvSource { + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "SecretEnvSource", + &[ + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecretEnvSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecretEnvSource", + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecretEnvSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecretEnvSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specify whether the Secret must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret_key_selector.rs b/src/v1_30/api/core/v1/secret_key_selector.rs new file mode 100644 index 000000000..ba4f95d67 --- /dev/null +++ b/src/v1_30/api/core/v1/secret_key_selector.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.core.v1.SecretKeySelector + +/// SecretKeySelector selects a key of a Secret. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecretKeySelector { + /// The key of the secret to select from. Must be a valid secret key. + pub key: String, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// Specify whether the Secret or its key must be defined + pub optional: Option, +} + +impl crate::DeepMerge for SecretKeySelector { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecretKeySelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecretKeySelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecretKeySelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecretKeySelector { + key: value_key.unwrap_or_default(), + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "SecretKeySelector", + &[ + "key", + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecretKeySelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecretKeySelector", + 1 + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecretKeySelector { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecretKeySelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecretKeySelector selects a key of a Secret.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The key of the secret to select from. Must be a valid secret key.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specify whether the Secret or its key must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret_projection.rs b/src/v1_30/api/core/v1/secret_projection.rs new file mode 100644 index 000000000..58cd75c10 --- /dev/null +++ b/src/v1_30/api/core/v1/secret_projection.rs @@ -0,0 +1,183 @@ +// Generated from definition io.k8s.api.core.v1.SecretProjection + +/// Adapts a secret into a projected volume. +/// +/// The contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecretProjection { + /// items if unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + pub items: Option>, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: Option, + + /// optional field specify whether the Secret or its key must be defined + pub optional: Option, +} + +impl crate::DeepMerge for SecretProjection { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.items, other.items); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecretProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_items, + Key_name, + Key_optional, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "items" => Field::Key_items, + "name" => Field::Key_name, + "optional" => Field::Key_optional, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecretProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecretProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_items: Option> = None; + let mut value_name: Option = None; + let mut value_optional: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecretProjection { + items: value_items, + name: value_name, + optional: value_optional, + }) + } + } + + deserializer.deserialize_struct( + "SecretProjection", + &[ + "items", + "name", + "optional", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecretProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecretProjection", + self.items.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecretProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecretProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Adapts a secret into a projected volume.\n\nThe contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("items if unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("optional field specify whether the Secret or its key must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret_reference.rs b/src/v1_30/api/core/v1/secret_reference.rs new file mode 100644 index 000000000..1aa808fdc --- /dev/null +++ b/src/v1_30/api/core/v1/secret_reference.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.SecretReference + +/// SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecretReference { + /// name is unique within a namespace to reference a secret resource. + pub name: Option, + + /// namespace defines the space within which the secret name must be unique. + pub namespace: Option, +} + +impl crate::DeepMerge for SecretReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecretReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecretReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecretReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecretReference { + name: value_name, + namespace: value_namespace, + }) + } + } + + deserializer.deserialize_struct( + "SecretReference", + &[ + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecretReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecretReference", + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecretReference { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecretReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is unique within a namespace to reference a secret resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace defines the space within which the secret name must be unique.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/secret_volume_source.rs b/src/v1_30/api/core/v1/secret_volume_source.rs new file mode 100644 index 000000000..9d45331f6 --- /dev/null +++ b/src/v1_30/api/core/v1/secret_volume_source.rs @@ -0,0 +1,209 @@ +// Generated from definition io.k8s.api.core.v1.SecretVolumeSource + +/// Adapts a Secret into a volume. +/// +/// The contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecretVolumeSource { + /// defaultMode is Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + pub default_mode: Option, + + /// items If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + pub items: Option>, + + /// optional field specify whether the Secret or its keys must be defined + pub optional: Option, + + /// secretName is the name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + pub secret_name: Option, +} + +impl crate::DeepMerge for SecretVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.default_mode, other.default_mode); + crate::merge_strategies::list::atomic(&mut self.items, other.items); + crate::DeepMerge::merge_from(&mut self.optional, other.optional); + crate::DeepMerge::merge_from(&mut self.secret_name, other.secret_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecretVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default_mode, + Key_items, + Key_optional, + Key_secret_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "defaultMode" => Field::Key_default_mode, + "items" => Field::Key_items, + "optional" => Field::Key_optional, + "secretName" => Field::Key_secret_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecretVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecretVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default_mode: Option = None; + let mut value_items: Option> = None; + let mut value_optional: Option = None; + let mut value_secret_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default_mode => value_default_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional => value_optional = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_name => value_secret_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecretVolumeSource { + default_mode: value_default_mode, + items: value_items, + optional: value_optional, + secret_name: value_secret_name, + }) + } + } + + deserializer.deserialize_struct( + "SecretVolumeSource", + &[ + "defaultMode", + "items", + "optional", + "secretName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecretVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecretVolumeSource", + self.default_mode.as_ref().map_or(0, |_| 1) + + self.items.as_ref().map_or(0, |_| 1) + + self.optional.as_ref().map_or(0, |_| 1) + + self.secret_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultMode", value)?; + } + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + if let Some(value) = &self.optional { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optional", value)?; + } + if let Some(value) = &self.secret_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecretVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecretVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Adapts a Secret into a volume.\n\nThe contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "defaultMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("defaultMode is Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "items".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("items If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "optional".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("optional field specify whether the Secret or its keys must be defined".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretName is the name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/security_context.rs b/src/v1_30/api/core/v1/security_context.rs new file mode 100644 index 000000000..c46ea5d4d --- /dev/null +++ b/src/v1_30/api/core/v1/security_context.rs @@ -0,0 +1,404 @@ +// Generated from definition io.k8s.api.core.v1.SecurityContext + +/// SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SecurityContext { + /// AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows. + pub allow_privilege_escalation: Option, + + /// appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows. + pub app_armor_profile: Option, + + /// The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows. + pub capabilities: Option, + + /// Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows. + pub privileged: Option, + + /// procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows. + pub proc_mount: Option, + + /// Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows. + pub read_only_root_filesystem: Option, + + /// The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + pub run_as_group: Option, + + /// Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + pub run_as_non_root: Option, + + /// The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + pub run_as_user: Option, + + /// The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows. + pub se_linux_options: Option, + + /// The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows. + pub seccomp_profile: Option, + + /// The Windows specific settings applied to all containers. If unspecified, the options from the PodSecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux. + pub windows_options: Option, +} + +impl crate::DeepMerge for SecurityContext { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allow_privilege_escalation, other.allow_privilege_escalation); + crate::DeepMerge::merge_from(&mut self.app_armor_profile, other.app_armor_profile); + crate::DeepMerge::merge_from(&mut self.capabilities, other.capabilities); + crate::DeepMerge::merge_from(&mut self.privileged, other.privileged); + crate::DeepMerge::merge_from(&mut self.proc_mount, other.proc_mount); + crate::DeepMerge::merge_from(&mut self.read_only_root_filesystem, other.read_only_root_filesystem); + crate::DeepMerge::merge_from(&mut self.run_as_group, other.run_as_group); + crate::DeepMerge::merge_from(&mut self.run_as_non_root, other.run_as_non_root); + crate::DeepMerge::merge_from(&mut self.run_as_user, other.run_as_user); + crate::DeepMerge::merge_from(&mut self.se_linux_options, other.se_linux_options); + crate::DeepMerge::merge_from(&mut self.seccomp_profile, other.seccomp_profile); + crate::DeepMerge::merge_from(&mut self.windows_options, other.windows_options); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SecurityContext { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allow_privilege_escalation, + Key_app_armor_profile, + Key_capabilities, + Key_privileged, + Key_proc_mount, + Key_read_only_root_filesystem, + Key_run_as_group, + Key_run_as_non_root, + Key_run_as_user, + Key_se_linux_options, + Key_seccomp_profile, + Key_windows_options, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allowPrivilegeEscalation" => Field::Key_allow_privilege_escalation, + "appArmorProfile" => Field::Key_app_armor_profile, + "capabilities" => Field::Key_capabilities, + "privileged" => Field::Key_privileged, + "procMount" => Field::Key_proc_mount, + "readOnlyRootFilesystem" => Field::Key_read_only_root_filesystem, + "runAsGroup" => Field::Key_run_as_group, + "runAsNonRoot" => Field::Key_run_as_non_root, + "runAsUser" => Field::Key_run_as_user, + "seLinuxOptions" => Field::Key_se_linux_options, + "seccompProfile" => Field::Key_seccomp_profile, + "windowsOptions" => Field::Key_windows_options, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SecurityContext; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SecurityContext") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allow_privilege_escalation: Option = None; + let mut value_app_armor_profile: Option = None; + let mut value_capabilities: Option = None; + let mut value_privileged: Option = None; + let mut value_proc_mount: Option = None; + let mut value_read_only_root_filesystem: Option = None; + let mut value_run_as_group: Option = None; + let mut value_run_as_non_root: Option = None; + let mut value_run_as_user: Option = None; + let mut value_se_linux_options: Option = None; + let mut value_seccomp_profile: Option = None; + let mut value_windows_options: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allow_privilege_escalation => value_allow_privilege_escalation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_app_armor_profile => value_app_armor_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_capabilities => value_capabilities = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_privileged => value_privileged = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_proc_mount => value_proc_mount = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only_root_filesystem => value_read_only_root_filesystem = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_group => value_run_as_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_non_root => value_run_as_non_root = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_user => value_run_as_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_se_linux_options => value_se_linux_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_seccomp_profile => value_seccomp_profile = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_windows_options => value_windows_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SecurityContext { + allow_privilege_escalation: value_allow_privilege_escalation, + app_armor_profile: value_app_armor_profile, + capabilities: value_capabilities, + privileged: value_privileged, + proc_mount: value_proc_mount, + read_only_root_filesystem: value_read_only_root_filesystem, + run_as_group: value_run_as_group, + run_as_non_root: value_run_as_non_root, + run_as_user: value_run_as_user, + se_linux_options: value_se_linux_options, + seccomp_profile: value_seccomp_profile, + windows_options: value_windows_options, + }) + } + } + + deserializer.deserialize_struct( + "SecurityContext", + &[ + "allowPrivilegeEscalation", + "appArmorProfile", + "capabilities", + "privileged", + "procMount", + "readOnlyRootFilesystem", + "runAsGroup", + "runAsNonRoot", + "runAsUser", + "seLinuxOptions", + "seccompProfile", + "windowsOptions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SecurityContext { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SecurityContext", + self.allow_privilege_escalation.as_ref().map_or(0, |_| 1) + + self.app_armor_profile.as_ref().map_or(0, |_| 1) + + self.capabilities.as_ref().map_or(0, |_| 1) + + self.privileged.as_ref().map_or(0, |_| 1) + + self.proc_mount.as_ref().map_or(0, |_| 1) + + self.read_only_root_filesystem.as_ref().map_or(0, |_| 1) + + self.run_as_group.as_ref().map_or(0, |_| 1) + + self.run_as_non_root.as_ref().map_or(0, |_| 1) + + self.run_as_user.as_ref().map_or(0, |_| 1) + + self.se_linux_options.as_ref().map_or(0, |_| 1) + + self.seccomp_profile.as_ref().map_or(0, |_| 1) + + self.windows_options.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allow_privilege_escalation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowPrivilegeEscalation", value)?; + } + if let Some(value) = &self.app_armor_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "appArmorProfile", value)?; + } + if let Some(value) = &self.capabilities { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capabilities", value)?; + } + if let Some(value) = &self.privileged { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "privileged", value)?; + } + if let Some(value) = &self.proc_mount { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "procMount", value)?; + } + if let Some(value) = &self.read_only_root_filesystem { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnlyRootFilesystem", value)?; + } + if let Some(value) = &self.run_as_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsGroup", value)?; + } + if let Some(value) = &self.run_as_non_root { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsNonRoot", value)?; + } + if let Some(value) = &self.run_as_user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsUser", value)?; + } + if let Some(value) = &self.se_linux_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seLinuxOptions", value)?; + } + if let Some(value) = &self.seccomp_profile { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seccompProfile", value)?; + } + if let Some(value) = &self.windows_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "windowsOptions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SecurityContext { + fn schema_name() -> String { + "io.k8s.api.core.v1.SecurityContext".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allowPrivilegeEscalation".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "appArmorProfile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "capabilities".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "privileged".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "procMount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnlyRootFilesystem".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "runAsGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "runAsNonRoot".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "runAsUser".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "seLinuxOptions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "seccompProfile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "windowsOptions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Windows specific settings applied to all containers. If unspecified, the options from the PodSecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service.rs b/src/v1_30/api/core/v1/service.rs new file mode 100644 index 000000000..4add73225 --- /dev/null +++ b/src/v1_30/api/core/v1/service.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.core.v1.Service + +/// Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Service { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Service { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Service"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "services"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Service { + const LIST_KIND: &'static str = "ServiceList"; +} + +impl crate::Metadata for Service { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Service { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Service { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Service; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Service { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Service { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Service { + fn schema_name() -> String { + "io.k8s.api.core.v1.Service".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service_account.rs b/src/v1_30/api/core/v1/service_account.rs new file mode 100644 index 000000000..f9cc91ab5 --- /dev/null +++ b/src/v1_30/api/core/v1/service_account.rs @@ -0,0 +1,285 @@ +// Generated from definition io.k8s.api.core.v1.ServiceAccount + +/// ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceAccount { + /// AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level. + pub automount_service_account_token: Option, + + /// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod + pub image_pull_secrets: Option>, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a "kubernetes.io/enforce-mountable-secrets" annotation set to "true". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret + pub secrets: Option>, +} + +impl crate::Resource for ServiceAccount { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "ServiceAccount"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "serviceaccounts"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ServiceAccount { + const LIST_KIND: &'static str = "ServiceAccountList"; +} + +impl crate::Metadata for ServiceAccount { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ServiceAccount { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.automount_service_account_token, other.automount_service_account_token); + crate::merge_strategies::list::atomic(&mut self.image_pull_secrets, other.image_pull_secrets); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::map( + &mut self.secrets, + other.secrets, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceAccount { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_automount_service_account_token, + Key_image_pull_secrets, + Key_metadata, + Key_secrets, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "automountServiceAccountToken" => Field::Key_automount_service_account_token, + "imagePullSecrets" => Field::Key_image_pull_secrets, + "metadata" => Field::Key_metadata, + "secrets" => Field::Key_secrets, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceAccount; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_automount_service_account_token: Option = None; + let mut value_image_pull_secrets: Option> = None; + let mut value_metadata: Option = None; + let mut value_secrets: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_automount_service_account_token => value_automount_service_account_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_image_pull_secrets => value_image_pull_secrets = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secrets => value_secrets = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceAccount { + automount_service_account_token: value_automount_service_account_token, + image_pull_secrets: value_image_pull_secrets, + metadata: value_metadata.unwrap_or_default(), + secrets: value_secrets, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "automountServiceAccountToken", + "imagePullSecrets", + "metadata", + "secrets", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceAccount { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.automount_service_account_token.as_ref().map_or(0, |_| 1) + + self.image_pull_secrets.as_ref().map_or(0, |_| 1) + + self.secrets.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.automount_service_account_token { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "automountServiceAccountToken", value)?; + } + if let Some(value) = &self.image_pull_secrets { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "imagePullSecrets", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.secrets { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secrets", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceAccount { + fn schema_name() -> String { + "io.k8s.api.core.v1.ServiceAccount".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "automountServiceAccountToken".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "imagePullSecrets".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "secrets".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Secrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a \"kubernetes.io/enforce-mountable-secrets\" annotation set to \"true\". This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secret".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service_account_token_projection.rs b/src/v1_30/api/core/v1/service_account_token_projection.rs new file mode 100644 index 000000000..0e04a0c6f --- /dev/null +++ b/src/v1_30/api/core/v1/service_account_token_projection.rs @@ -0,0 +1,179 @@ +// Generated from definition io.k8s.api.core.v1.ServiceAccountTokenProjection + +/// ServiceAccountTokenProjection represents a projected service account token volume. This projection can be used to insert a service account token into the pods runtime filesystem for use against APIs (Kubernetes API Server or otherwise). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceAccountTokenProjection { + /// audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver. + pub audience: Option, + + /// expirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes. + pub expiration_seconds: Option, + + /// path is the path relative to the mount point of the file to project the token into. + pub path: String, +} + +impl crate::DeepMerge for ServiceAccountTokenProjection { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.audience, other.audience); + crate::DeepMerge::merge_from(&mut self.expiration_seconds, other.expiration_seconds); + crate::DeepMerge::merge_from(&mut self.path, other.path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceAccountTokenProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audience, + Key_expiration_seconds, + Key_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "audience" => Field::Key_audience, + "expirationSeconds" => Field::Key_expiration_seconds, + "path" => Field::Key_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceAccountTokenProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceAccountTokenProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audience: Option = None; + let mut value_expiration_seconds: Option = None; + let mut value_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audience => value_audience = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_expiration_seconds => value_expiration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceAccountTokenProjection { + audience: value_audience, + expiration_seconds: value_expiration_seconds, + path: value_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ServiceAccountTokenProjection", + &[ + "audience", + "expirationSeconds", + "path", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceAccountTokenProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceAccountTokenProjection", + 1 + + self.audience.as_ref().map_or(0, |_| 1) + + self.expiration_seconds.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.audience { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "audience", value)?; + } + if let Some(value) = &self.expiration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expirationSeconds", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", &self.path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceAccountTokenProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.ServiceAccountTokenProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceAccountTokenProjection represents a projected service account token volume. This projection can be used to insert a service account token into the pods runtime filesystem for use against APIs (Kubernetes API Server or otherwise).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "audience".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "expirationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("expirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is the path relative to the mount point of the file to project the token into.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "path".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service_port.rs b/src/v1_30/api/core/v1/service_port.rs new file mode 100644 index 000000000..4d60771fe --- /dev/null +++ b/src/v1_30/api/core/v1/service_port.rs @@ -0,0 +1,264 @@ +// Generated from definition io.k8s.api.core.v1.ServicePort + +/// ServicePort contains information on service's port. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServicePort { + /// The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either: + /// + /// * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). + /// + /// * Kubernetes-defined prefixed names: + /// * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + /// * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + /// * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + /// + /// * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. + pub app_protocol: Option, + + /// The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. When considering the endpoints for a Service, this must match the 'name' field in the EndpointPort. Optional if only one ServicePort is defined on this service. + pub name: Option, + + /// The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + pub node_port: Option, + + /// The port that will be exposed by this service. + pub port: i32, + + /// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Default is TCP. + pub protocol: Option, + + /// Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + pub target_port: Option, +} + +impl crate::DeepMerge for ServicePort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.app_protocol, other.app_protocol); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.node_port, other.node_port); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + crate::DeepMerge::merge_from(&mut self.target_port, other.target_port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServicePort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_app_protocol, + Key_name, + Key_node_port, + Key_port, + Key_protocol, + Key_target_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "appProtocol" => Field::Key_app_protocol, + "name" => Field::Key_name, + "nodePort" => Field::Key_node_port, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + "targetPort" => Field::Key_target_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServicePort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServicePort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_app_protocol: Option = None; + let mut value_name: Option = None; + let mut value_node_port: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + let mut value_target_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_app_protocol => value_app_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_port => value_node_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_port => value_target_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServicePort { + app_protocol: value_app_protocol, + name: value_name, + node_port: value_node_port, + port: value_port.unwrap_or_default(), + protocol: value_protocol, + target_port: value_target_port, + }) + } + } + + deserializer.deserialize_struct( + "ServicePort", + &[ + "appProtocol", + "name", + "nodePort", + "port", + "protocol", + "targetPort", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServicePort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServicePort", + 1 + + self.app_protocol.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.node_port.as_ref().map_or(0, |_| 1) + + self.protocol.as_ref().map_or(0, |_| 1) + + self.target_port.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.app_protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "appProtocol", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.node_port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodePort", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + if let Some(value) = &self.protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", value)?; + } + if let Some(value) = &self.target_port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetPort", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServicePort { + fn schema_name() -> String { + "io.k8s.api.core.v1.ServicePort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServicePort contains information on service's port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "appProtocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either:\n\n* Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names).\n\n* Kubernetes-defined prefixed names:\n * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-\n * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455\n * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455\n\n* Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. When considering the endpoints for a Service, this must match the 'name' field in the EndpointPort. Optional if only one ServicePort is defined on this service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodePort".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The port that will be exposed by this service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "targetPort".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service_spec.rs b/src/v1_30/api/core/v1/service_spec.rs new file mode 100644 index 000000000..42350915d --- /dev/null +++ b/src/v1_30/api/core/v1/service_spec.rs @@ -0,0 +1,663 @@ +// Generated from definition io.k8s.api.core.v1.ServiceSpec + +/// ServiceSpec describes the attributes that a user creates on a service. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceSpec { + /// allocateLoadBalancerNodePorts defines if NodePorts will be automatically allocated for services with type LoadBalancer. Default is "true". It may be set to "false" if the cluster load-balancer does not rely on NodePorts. If the caller requests specific NodePorts (by specifying a value), those requests will be respected, regardless of this field. This field may only be set for services with type LoadBalancer and will be cleared if the type is changed to any other type. + pub allocate_load_balancer_node_ports: Option, + + /// clusterIP is the IP address of the service and is usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be blank) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + pub cluster_ip: Option, + + /// ClusterIPs is a list of IP addresses assigned to this service, and are usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be empty) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are "None", empty string (""), or a valid IP address. Setting this to "None" makes a "headless service" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. If this field is not specified, it will be initialized from the clusterIP field. If this field is specified, clients must ensure that clusterIPs\[0\] and clusterIP have the same value. + /// + /// This field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + pub cluster_ips: Option>, + + /// externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system. + pub external_ips: Option>, + + /// externalName is the external reference that discovery mechanisms will return as an alias for this service (e.g. a DNS CNAME record). No proxying will be involved. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires `type` to be "ExternalName". + pub external_name: Option, + + /// externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's "externally-facing" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get "Cluster" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node. + pub external_traffic_policy: Option, + + /// healthCheckNodePort specifies the healthcheck nodePort for the service. This only applies when type is set to LoadBalancer and externalTrafficPolicy is set to Local. If a value is specified, is in-range, and is not in use, it will be used. If not specified, a value will be automatically allocated. External systems (e.g. load-balancers) can use this port to determine if a given node holds endpoints for this service or not. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type). This field cannot be updated once set. + pub health_check_node_port: Option, + + /// InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP. If set to "Local", the proxy will assume that pods only want to talk to endpoints of the service on the same node as the pod, dropping the traffic if there are no local endpoints. The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). + pub internal_traffic_policy: Option, + + /// IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this service. This field is usually assigned automatically based on cluster configuration and the ipFamilyPolicy field. If this field is specified manually, the requested family is available in the cluster, and ipFamilyPolicy allows it, it will be used; otherwise creation of the service will fail. This field is conditionally mutable: it allows for adding or removing a secondary IP family, but it does not allow changing the primary IP family of the Service. Valid values are "IPv4" and "IPv6". This field only applies to Services of types ClusterIP, NodePort, and LoadBalancer, and does apply to "headless" services. This field will be wiped when updating a Service to type ExternalName. + /// + /// This field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. + pub ip_families: Option>, + + /// IPFamilyPolicy represents the dual-stack-ness requested or required by this Service. If there is no value provided, then this field will be set to SingleStack. Services can be "SingleStack" (a single IP family), "PreferDualStack" (two IP families on dual-stack configured clusters or a single IP family on single-stack clusters), or "RequireDualStack" (two IP families on dual-stack configured clusters, otherwise fail). The ipFamilies and clusterIPs fields depend on the value of this field. This field will be wiped when updating a service to type ExternalName. + pub ip_family_policy: Option, + + /// loadBalancerClass is the class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix, e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users. This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load balancer implementation is used, today this is typically done through the cloud provider integration, but should apply for any default implementation. If set, it is assumed that a load balancer implementation is watching for Services with a matching class. Any default load balancer implementation (e.g. cloud providers) should ignore Services that set this field. This field can only be set when creating or updating a Service to type 'LoadBalancer'. Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type. + pub load_balancer_class: Option, + + /// Only applies to Service Type: LoadBalancer. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature. Deprecated: This field was under-specified and its meaning varies across implementations. Using it is non-portable and it may not support dual-stack. Users are encouraged to use implementation-specific annotations when available. + pub load_balancer_ip: Option, + + /// If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature." More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/ + pub load_balancer_source_ranges: Option>, + + /// The list of ports that are exposed by this service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + pub ports: Option>, + + /// publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready. The primary use case for setting this field is for a StatefulSet's Headless Service to propagate SRV DNS records for its Pods for the purpose of peer discovery. The Kubernetes controllers that generate Endpoints and EndpointSlice resources for Services interpret this to mean that all endpoints are considered "ready" even if the Pods themselves are not. Agents which consume only Kubernetes generated endpoints through the Endpoints or EndpointSlice resources can safely assume this behavior. + pub publish_not_ready_addresses: Option, + + /// Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/ + pub selector: Option>, + + /// Supports "ClientIP" and "None". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + pub session_affinity: Option, + + /// sessionAffinityConfig contains the configurations of session affinity. + pub session_affinity_config: Option, + + /// TrafficDistribution offers a way to express preferences for how traffic is distributed to Service endpoints. Implementations can use this field as a hint, but are not required to guarantee strict adherence. If the field is not set, the implementation will apply its default routing strategy. If set to "PreferClose", implementations should prioritize endpoints that are topologically close (e.g., same zone). + pub traffic_distribution: Option, + + /// type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. "ClusterIP" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object or EndpointSlice objects. If clusterIP is "None", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a virtual IP. "NodePort" builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP. "LoadBalancer" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the same endpoints as the clusterIP. "ExternalName" aliases this service to the specified externalName. Several other fields do not apply to ExternalName services. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + pub type_: Option, +} + +impl crate::DeepMerge for ServiceSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allocate_load_balancer_node_ports, other.allocate_load_balancer_node_ports); + crate::DeepMerge::merge_from(&mut self.cluster_ip, other.cluster_ip); + crate::merge_strategies::list::atomic(&mut self.cluster_ips, other.cluster_ips); + crate::merge_strategies::list::atomic(&mut self.external_ips, other.external_ips); + crate::DeepMerge::merge_from(&mut self.external_name, other.external_name); + crate::DeepMerge::merge_from(&mut self.external_traffic_policy, other.external_traffic_policy); + crate::DeepMerge::merge_from(&mut self.health_check_node_port, other.health_check_node_port); + crate::DeepMerge::merge_from(&mut self.internal_traffic_policy, other.internal_traffic_policy); + crate::merge_strategies::list::atomic(&mut self.ip_families, other.ip_families); + crate::DeepMerge::merge_from(&mut self.ip_family_policy, other.ip_family_policy); + crate::DeepMerge::merge_from(&mut self.load_balancer_class, other.load_balancer_class); + crate::DeepMerge::merge_from(&mut self.load_balancer_ip, other.load_balancer_ip); + crate::merge_strategies::list::atomic(&mut self.load_balancer_source_ranges, other.load_balancer_source_ranges); + crate::merge_strategies::list::map( + &mut self.ports, + other.ports, + &[|lhs, rhs| lhs.port == rhs.port], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.publish_not_ready_addresses, other.publish_not_ready_addresses); + crate::merge_strategies::map::atomic(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.session_affinity, other.session_affinity); + crate::DeepMerge::merge_from(&mut self.session_affinity_config, other.session_affinity_config); + crate::DeepMerge::merge_from(&mut self.traffic_distribution, other.traffic_distribution); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allocate_load_balancer_node_ports, + Key_cluster_ip, + Key_cluster_ips, + Key_external_ips, + Key_external_name, + Key_external_traffic_policy, + Key_health_check_node_port, + Key_internal_traffic_policy, + Key_ip_families, + Key_ip_family_policy, + Key_load_balancer_class, + Key_load_balancer_ip, + Key_load_balancer_source_ranges, + Key_ports, + Key_publish_not_ready_addresses, + Key_selector, + Key_session_affinity, + Key_session_affinity_config, + Key_traffic_distribution, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allocateLoadBalancerNodePorts" => Field::Key_allocate_load_balancer_node_ports, + "clusterIP" => Field::Key_cluster_ip, + "clusterIPs" => Field::Key_cluster_ips, + "externalIPs" => Field::Key_external_ips, + "externalName" => Field::Key_external_name, + "externalTrafficPolicy" => Field::Key_external_traffic_policy, + "healthCheckNodePort" => Field::Key_health_check_node_port, + "internalTrafficPolicy" => Field::Key_internal_traffic_policy, + "ipFamilies" => Field::Key_ip_families, + "ipFamilyPolicy" => Field::Key_ip_family_policy, + "loadBalancerClass" => Field::Key_load_balancer_class, + "loadBalancerIP" => Field::Key_load_balancer_ip, + "loadBalancerSourceRanges" => Field::Key_load_balancer_source_ranges, + "ports" => Field::Key_ports, + "publishNotReadyAddresses" => Field::Key_publish_not_ready_addresses, + "selector" => Field::Key_selector, + "sessionAffinity" => Field::Key_session_affinity, + "sessionAffinityConfig" => Field::Key_session_affinity_config, + "trafficDistribution" => Field::Key_traffic_distribution, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allocate_load_balancer_node_ports: Option = None; + let mut value_cluster_ip: Option = None; + let mut value_cluster_ips: Option> = None; + let mut value_external_ips: Option> = None; + let mut value_external_name: Option = None; + let mut value_external_traffic_policy: Option = None; + let mut value_health_check_node_port: Option = None; + let mut value_internal_traffic_policy: Option = None; + let mut value_ip_families: Option> = None; + let mut value_ip_family_policy: Option = None; + let mut value_load_balancer_class: Option = None; + let mut value_load_balancer_ip: Option = None; + let mut value_load_balancer_source_ranges: Option> = None; + let mut value_ports: Option> = None; + let mut value_publish_not_ready_addresses: Option = None; + let mut value_selector: Option> = None; + let mut value_session_affinity: Option = None; + let mut value_session_affinity_config: Option = None; + let mut value_traffic_distribution: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allocate_load_balancer_node_ports => value_allocate_load_balancer_node_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cluster_ip => value_cluster_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cluster_ips => value_cluster_ips = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external_ips => value_external_ips = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external_name => value_external_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external_traffic_policy => value_external_traffic_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_health_check_node_port => value_health_check_node_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_internal_traffic_policy => value_internal_traffic_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip_families => value_ip_families = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip_family_policy => value_ip_family_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_load_balancer_class => value_load_balancer_class = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_load_balancer_ip => value_load_balancer_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_load_balancer_source_ranges => value_load_balancer_source_ranges = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_publish_not_ready_addresses => value_publish_not_ready_addresses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_session_affinity => value_session_affinity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_session_affinity_config => value_session_affinity_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_traffic_distribution => value_traffic_distribution = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceSpec { + allocate_load_balancer_node_ports: value_allocate_load_balancer_node_ports, + cluster_ip: value_cluster_ip, + cluster_ips: value_cluster_ips, + external_ips: value_external_ips, + external_name: value_external_name, + external_traffic_policy: value_external_traffic_policy, + health_check_node_port: value_health_check_node_port, + internal_traffic_policy: value_internal_traffic_policy, + ip_families: value_ip_families, + ip_family_policy: value_ip_family_policy, + load_balancer_class: value_load_balancer_class, + load_balancer_ip: value_load_balancer_ip, + load_balancer_source_ranges: value_load_balancer_source_ranges, + ports: value_ports, + publish_not_ready_addresses: value_publish_not_ready_addresses, + selector: value_selector, + session_affinity: value_session_affinity, + session_affinity_config: value_session_affinity_config, + traffic_distribution: value_traffic_distribution, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "ServiceSpec", + &[ + "allocateLoadBalancerNodePorts", + "clusterIP", + "clusterIPs", + "externalIPs", + "externalName", + "externalTrafficPolicy", + "healthCheckNodePort", + "internalTrafficPolicy", + "ipFamilies", + "ipFamilyPolicy", + "loadBalancerClass", + "loadBalancerIP", + "loadBalancerSourceRanges", + "ports", + "publishNotReadyAddresses", + "selector", + "sessionAffinity", + "sessionAffinityConfig", + "trafficDistribution", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceSpec", + self.allocate_load_balancer_node_ports.as_ref().map_or(0, |_| 1) + + self.cluster_ip.as_ref().map_or(0, |_| 1) + + self.cluster_ips.as_ref().map_or(0, |_| 1) + + self.external_ips.as_ref().map_or(0, |_| 1) + + self.external_name.as_ref().map_or(0, |_| 1) + + self.external_traffic_policy.as_ref().map_or(0, |_| 1) + + self.health_check_node_port.as_ref().map_or(0, |_| 1) + + self.internal_traffic_policy.as_ref().map_or(0, |_| 1) + + self.ip_families.as_ref().map_or(0, |_| 1) + + self.ip_family_policy.as_ref().map_or(0, |_| 1) + + self.load_balancer_class.as_ref().map_or(0, |_| 1) + + self.load_balancer_ip.as_ref().map_or(0, |_| 1) + + self.load_balancer_source_ranges.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1) + + self.publish_not_ready_addresses.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1) + + self.session_affinity.as_ref().map_or(0, |_| 1) + + self.session_affinity_config.as_ref().map_or(0, |_| 1) + + self.traffic_distribution.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allocate_load_balancer_node_ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocateLoadBalancerNodePorts", value)?; + } + if let Some(value) = &self.cluster_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterIP", value)?; + } + if let Some(value) = &self.cluster_ips { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterIPs", value)?; + } + if let Some(value) = &self.external_ips { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "externalIPs", value)?; + } + if let Some(value) = &self.external_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "externalName", value)?; + } + if let Some(value) = &self.external_traffic_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "externalTrafficPolicy", value)?; + } + if let Some(value) = &self.health_check_node_port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "healthCheckNodePort", value)?; + } + if let Some(value) = &self.internal_traffic_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "internalTrafficPolicy", value)?; + } + if let Some(value) = &self.ip_families { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipFamilies", value)?; + } + if let Some(value) = &self.ip_family_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipFamilyPolicy", value)?; + } + if let Some(value) = &self.load_balancer_class { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "loadBalancerClass", value)?; + } + if let Some(value) = &self.load_balancer_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "loadBalancerIP", value)?; + } + if let Some(value) = &self.load_balancer_source_ranges { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "loadBalancerSourceRanges", value)?; + } + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + if let Some(value) = &self.publish_not_ready_addresses { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "publishNotReadyAddresses", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + if let Some(value) = &self.session_affinity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sessionAffinity", value)?; + } + if let Some(value) = &self.session_affinity_config { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "sessionAffinityConfig", value)?; + } + if let Some(value) = &self.traffic_distribution { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "trafficDistribution", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceSpec { + fn schema_name() -> String { + "io.k8s.api.core.v1.ServiceSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceSpec describes the attributes that a user creates on a service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allocateLoadBalancerNodePorts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allocateLoadBalancerNodePorts defines if NodePorts will be automatically allocated for services with type LoadBalancer. Default is \"true\". It may be set to \"false\" if the cluster load-balancer does not rely on NodePorts. If the caller requests specific NodePorts (by specifying a value), those requests will be respected, regardless of this field. This field may only be set for services with type LoadBalancer and will be cleared if the type is changed to any other type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "clusterIP".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("clusterIP is the IP address of the service and is usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be blank) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are \"None\", empty string (\"\"), or a valid IP address. Setting this to \"None\" makes a \"headless service\" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "clusterIPs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterIPs is a list of IP addresses assigned to this service, and are usually assigned randomly. If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail. This field may not be changed through updates unless the type field is also being changed to ExternalName (which requires this field to be empty) or the type field is being changed from ExternalName (in which case this field may optionally be specified, as describe above). Valid values are \"None\", empty string (\"\"), or a valid IP address. Setting this to \"None\" makes a \"headless service\" (no virtual IP), which is useful when direct endpoint connections are preferred and proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. If this field is specified when creating a Service of type ExternalName, creation will fail. This field will be wiped when updating a Service to type ExternalName. If this field is not specified, it will be initialized from the clusterIP field. If this field is specified, clients must ensure that clusterIPs[0] and clusterIP have the same value.\n\nThis field may hold a maximum of two entries (dual-stack IPs, in either order). These IPs must correspond to the values of the ipFamilies field. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "externalIPs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "externalName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("externalName is the external reference that discovery mechanisms will return as an alias for this service (e.g. a DNS CNAME record). No proxying will be involved. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires `type` to be \"ExternalName\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "externalTrafficPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's \"externally-facing\" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to \"Local\", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, \"Cluster\", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get \"Cluster\" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "healthCheckNodePort".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("healthCheckNodePort specifies the healthcheck nodePort for the service. This only applies when type is set to LoadBalancer and externalTrafficPolicy is set to Local. If a value is specified, is in-range, and is not in use, it will be used. If not specified, a value will be automatically allocated. External systems (e.g. load-balancers) can use this port to determine if a given node holds endpoints for this service or not. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type). This field cannot be updated once set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "internalTrafficPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP. If set to \"Local\", the proxy will assume that pods only want to talk to endpoints of the service on the same node as the pod, dropping the traffic if there are no local endpoints. The default value, \"Cluster\", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ipFamilies".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPFamilies is a list of IP families (e.g. IPv4, IPv6) assigned to this service. This field is usually assigned automatically based on cluster configuration and the ipFamilyPolicy field. If this field is specified manually, the requested family is available in the cluster, and ipFamilyPolicy allows it, it will be used; otherwise creation of the service will fail. This field is conditionally mutable: it allows for adding or removing a secondary IP family, but it does not allow changing the primary IP family of the Service. Valid values are \"IPv4\" and \"IPv6\". This field only applies to Services of types ClusterIP, NodePort, and LoadBalancer, and does apply to \"headless\" services. This field will be wiped when updating a Service to type ExternalName.\n\nThis field may hold a maximum of two entries (dual-stack families, in either order). These families must correspond to the values of the clusterIPs field, if specified. Both clusterIPs and ipFamilies are governed by the ipFamilyPolicy field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ipFamilyPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPFamilyPolicy represents the dual-stack-ness requested or required by this Service. If there is no value provided, then this field will be set to SingleStack. Services can be \"SingleStack\" (a single IP family), \"PreferDualStack\" (two IP families on dual-stack configured clusters or a single IP family on single-stack clusters), or \"RequireDualStack\" (two IP families on dual-stack configured clusters, otherwise fail). The ipFamilies and clusterIPs fields depend on the value of this field. This field will be wiped when updating a service to type ExternalName.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "loadBalancerClass".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("loadBalancerClass is the class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix, e.g. \"internal-vip\" or \"example.com/internal-vip\". Unprefixed names are reserved for end-users. This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load balancer implementation is used, today this is typically done through the cloud provider integration, but should apply for any default implementation. If set, it is assumed that a load balancer implementation is watching for Services with a matching class. Any default load balancer implementation (e.g. cloud providers) should ignore Services that set this field. This field can only be set when creating or updating a Service to type 'LoadBalancer'. Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "loadBalancerIP".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Only applies to Service Type: LoadBalancer. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature. Deprecated: This field was under-specified and its meaning varies across implementations. Using it is non-portable and it may not support dual-stack. Users are encouraged to use implementation-specific annotations when available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "loadBalancerSourceRanges".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature.\" More info: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The list of ports that are exposed by this service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "publishNotReadyAddresses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("publishNotReadyAddresses indicates that any agent which deals with endpoints for this Service should disregard any indications of ready/not-ready. The primary use case for setting this field is for a StatefulSet's Headless Service to propagate SRV DNS records for its Pods for the purpose of peer discovery. The Kubernetes controllers that generate Endpoints and EndpointSlice resources for Services interpret this to mean that all endpoints are considered \"ready\" even if the Pods themselves are not. Agents which consume only Kubernetes generated endpoints through the Endpoints or EndpointSlice resources can safely assume this behavior.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "selector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "sessionAffinity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Supports \"ClientIP\" and \"None\". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "sessionAffinityConfig".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("sessionAffinityConfig contains the configurations of session affinity.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "trafficDistribution".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TrafficDistribution offers a way to express preferences for how traffic is distributed to Service endpoints. Implementations can use this field as a hint, but are not required to guarantee strict adherence. If the field is not set, the implementation will apply its default routing strategy. If set to \"PreferClose\", implementations should prioritize endpoints that are topologically close (e.g., same zone).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. \"ClusterIP\" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object or EndpointSlice objects. If clusterIP is \"None\", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a virtual IP. \"NodePort\" builds on ClusterIP and allocates a port on every node which routes to the same endpoints as the clusterIP. \"LoadBalancer\" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the same endpoints as the clusterIP. \"ExternalName\" aliases this service to the specified externalName. Several other fields do not apply to ExternalName services. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/service_status.rs b/src/v1_30/api/core/v1/service_status.rs new file mode 100644 index 000000000..6dece09b9 --- /dev/null +++ b/src/v1_30/api/core/v1/service_status.rs @@ -0,0 +1,163 @@ +// Generated from definition io.k8s.api.core.v1.ServiceStatus + +/// ServiceStatus represents the current status of a service. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceStatus { + /// Current service state + pub conditions: Option>, + + /// LoadBalancer contains the current status of the load-balancer, if one is present. + pub load_balancer: Option, +} + +impl crate::DeepMerge for ServiceStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.load_balancer, other.load_balancer); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_load_balancer, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "loadBalancer" => Field::Key_load_balancer, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_load_balancer: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_load_balancer => value_load_balancer = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceStatus { + conditions: value_conditions, + load_balancer: value_load_balancer, + }) + } + } + + deserializer.deserialize_struct( + "ServiceStatus", + &[ + "conditions", + "loadBalancer", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.load_balancer.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.load_balancer { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "loadBalancer", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.ServiceStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceStatus represents the current status of a service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Current service state".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "loadBalancer".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LoadBalancer contains the current status of the load-balancer, if one is present.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/session_affinity_config.rs b/src/v1_30/api/core/v1/session_affinity_config.rs new file mode 100644 index 000000000..0429ae89c --- /dev/null +++ b/src/v1_30/api/core/v1/session_affinity_config.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.SessionAffinityConfig + +/// SessionAffinityConfig represents the configurations of session affinity. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SessionAffinityConfig { + /// clientIP contains the configurations of Client IP based session affinity. + pub client_ip: Option, +} + +impl crate::DeepMerge for SessionAffinityConfig { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.client_ip, other.client_ip); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SessionAffinityConfig { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_client_ip, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "clientIP" => Field::Key_client_ip, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SessionAffinityConfig; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SessionAffinityConfig") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_client_ip: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_client_ip => value_client_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SessionAffinityConfig { + client_ip: value_client_ip, + }) + } + } + + deserializer.deserialize_struct( + "SessionAffinityConfig", + &[ + "clientIP", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SessionAffinityConfig { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SessionAffinityConfig", + self.client_ip.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.client_ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clientIP", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SessionAffinityConfig { + fn schema_name() -> String { + "io.k8s.api.core.v1.SessionAffinityConfig".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SessionAffinityConfig represents the configurations of session affinity.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "clientIP".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("clientIP contains the configurations of Client IP based session affinity.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/sleep_action.rs b/src/v1_30/api/core/v1/sleep_action.rs new file mode 100644 index 000000000..b4af4054e --- /dev/null +++ b/src/v1_30/api/core/v1/sleep_action.rs @@ -0,0 +1,129 @@ +// Generated from definition io.k8s.api.core.v1.SleepAction + +/// SleepAction describes a "sleep" action. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SleepAction { + /// Seconds is the number of seconds to sleep. + pub seconds: i64, +} + +impl crate::DeepMerge for SleepAction { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.seconds, other.seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SleepAction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "seconds" => Field::Key_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SleepAction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SleepAction") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_seconds => value_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SleepAction { + seconds: value_seconds.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "SleepAction", + &[ + "seconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SleepAction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SleepAction", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seconds", &self.seconds)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SleepAction { + fn schema_name() -> String { + "io.k8s.api.core.v1.SleepAction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SleepAction describes a \"sleep\" action.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "seconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Seconds is the number of seconds to sleep.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "seconds".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/storage_os_persistent_volume_source.rs b/src/v1_30/api/core/v1/storage_os_persistent_volume_source.rs new file mode 100644 index 000000000..3c2b7aaae --- /dev/null +++ b/src/v1_30/api/core/v1/storage_os_persistent_volume_source.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.core.v1.StorageOSPersistentVolumeSource + +/// Represents a StorageOS persistent volume resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageOSPersistentVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted. + pub secret_ref: Option, + + /// volumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace. + pub volume_name: Option, + + /// volumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. + pub volume_namespace: Option, +} + +impl crate::DeepMerge for StorageOSPersistentVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.volume_name, other.volume_name); + crate::DeepMerge::merge_from(&mut self.volume_namespace, other.volume_namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageOSPersistentVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_read_only, + Key_secret_ref, + Key_volume_name, + Key_volume_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "volumeName" => Field::Key_volume_name, + "volumeNamespace" => Field::Key_volume_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageOSPersistentVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageOSPersistentVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_volume_name: Option = None; + let mut value_volume_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_name => value_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_namespace => value_volume_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageOSPersistentVolumeSource { + fs_type: value_fs_type, + read_only: value_read_only, + secret_ref: value_secret_ref, + volume_name: value_volume_name, + volume_namespace: value_volume_namespace, + }) + } + } + + deserializer.deserialize_struct( + "StorageOSPersistentVolumeSource", + &[ + "fsType", + "readOnly", + "secretRef", + "volumeName", + "volumeNamespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageOSPersistentVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageOSPersistentVolumeSource", + self.fs_type.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.volume_name.as_ref().map_or(0, |_| 1) + + self.volume_namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeName", value)?; + } + if let Some(value) = &self.volume_namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeNamespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageOSPersistentVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.StorageOSPersistentVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a StorageOS persistent volume resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeNamespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/storage_os_volume_source.rs b/src/v1_30/api/core/v1/storage_os_volume_source.rs new file mode 100644 index 000000000..c5256bc5d --- /dev/null +++ b/src/v1_30/api/core/v1/storage_os_volume_source.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.core.v1.StorageOSVolumeSource + +/// Represents a StorageOS persistent volume resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageOSVolumeSource { + /// fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + pub read_only: Option, + + /// secretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted. + pub secret_ref: Option, + + /// volumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace. + pub volume_name: Option, + + /// volumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. + pub volume_namespace: Option, +} + +impl crate::DeepMerge for StorageOSVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.secret_ref, other.secret_ref); + crate::DeepMerge::merge_from(&mut self.volume_name, other.volume_name); + crate::DeepMerge::merge_from(&mut self.volume_namespace, other.volume_namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageOSVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_read_only, + Key_secret_ref, + Key_volume_name, + Key_volume_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "readOnly" => Field::Key_read_only, + "secretRef" => Field::Key_secret_ref, + "volumeName" => Field::Key_volume_name, + "volumeNamespace" => Field::Key_volume_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageOSVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageOSVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_read_only: Option = None; + let mut value_secret_ref: Option = None; + let mut value_volume_name: Option = None; + let mut value_volume_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_ref => value_secret_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_name => value_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_namespace => value_volume_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageOSVolumeSource { + fs_type: value_fs_type, + read_only: value_read_only, + secret_ref: value_secret_ref, + volume_name: value_volume_name, + volume_namespace: value_volume_namespace, + }) + } + } + + deserializer.deserialize_struct( + "StorageOSVolumeSource", + &[ + "fsType", + "readOnly", + "secretRef", + "volumeName", + "volumeNamespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageOSVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageOSVolumeSource", + self.fs_type.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.secret_ref.as_ref().map_or(0, |_| 1) + + self.volume_name.as_ref().map_or(0, |_| 1) + + self.volume_namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.secret_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretRef", value)?; + } + if let Some(value) = &self.volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeName", value)?; + } + if let Some(value) = &self.volume_namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeNamespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageOSVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.StorageOSVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a StorageOS persistent volume resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "secretRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "volumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeNamespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/sysctl.rs b/src/v1_30/api/core/v1/sysctl.rs new file mode 100644 index 000000000..912b47347 --- /dev/null +++ b/src/v1_30/api/core/v1/sysctl.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.Sysctl + +/// Sysctl defines a kernel parameter to be set +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Sysctl { + /// Name of a property to set + pub name: String, + + /// Value of a property to set + pub value: String, +} + +impl crate::DeepMerge for Sysctl { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Sysctl { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Sysctl; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Sysctl") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Sysctl { + name: value_name.unwrap_or_default(), + value: value_value.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Sysctl", + &[ + "name", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Sysctl { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Sysctl", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", &self.value)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Sysctl { + fn schema_name() -> String { + "io.k8s.api.core.v1.Sysctl".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Sysctl defines a kernel parameter to be set".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of a property to set".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Value of a property to set".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "value".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/taint.rs b/src/v1_30/api/core/v1/taint.rs new file mode 100644 index 000000000..c2bff745a --- /dev/null +++ b/src/v1_30/api/core/v1/taint.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.core.v1.Taint + +/// The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Taint { + /// Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute. + pub effect: String, + + /// Required. The taint key to be applied to a node. + pub key: String, + + /// TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints. + pub time_added: Option, + + /// The taint value corresponding to the taint key. + pub value: Option, +} + +impl crate::DeepMerge for Taint { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.effect, other.effect); + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.time_added, other.time_added); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Taint { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_effect, + Key_key, + Key_time_added, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "effect" => Field::Key_effect, + "key" => Field::Key_key, + "timeAdded" => Field::Key_time_added, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Taint; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Taint") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_effect: Option = None; + let mut value_key: Option = None; + let mut value_time_added: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_effect => value_effect = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_time_added => value_time_added = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Taint { + effect: value_effect.unwrap_or_default(), + key: value_key.unwrap_or_default(), + time_added: value_time_added, + value: value_value, + }) + } + } + + deserializer.deserialize_struct( + "Taint", + &[ + "effect", + "key", + "timeAdded", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Taint { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Taint", + 2 + + self.time_added.as_ref().map_or(0, |_| 1) + + self.value.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "effect", &self.effect)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + if let Some(value) = &self.time_added { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "timeAdded", value)?; + } + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Taint { + fn schema_name() -> String { + "io.k8s.api.core.v1.Taint".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The node this Taint is attached to has the \"effect\" on any pod that does not tolerate the Taint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "effect".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required. The taint key to be applied to a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "timeAdded".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The taint value corresponding to the taint key.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "effect".to_owned(), + "key".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/tcp_socket_action.rs b/src/v1_30/api/core/v1/tcp_socket_action.rs new file mode 100644 index 000000000..4b987cb82 --- /dev/null +++ b/src/v1_30/api/core/v1/tcp_socket_action.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.core.v1.TCPSocketAction + +/// TCPSocketAction describes an action based on opening a socket +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TCPSocketAction { + /// Optional: Host name to connect to, defaults to the pod IP. + pub host: Option, + + /// Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + pub port: crate::apimachinery::pkg::util::intstr::IntOrString, +} + +impl crate::DeepMerge for TCPSocketAction { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.host, other.host); + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TCPSocketAction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_host, + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "host" => Field::Key_host, + "port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TCPSocketAction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TCPSocketAction") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_host: Option = None; + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_host => value_host = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TCPSocketAction { + host: value_host, + port: value_port.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "TCPSocketAction", + &[ + "host", + "port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TCPSocketAction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TCPSocketAction", + 1 + + self.host.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.host { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "host", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TCPSocketAction { + fn schema_name() -> String { + "io.k8s.api.core.v1.TCPSocketAction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TCPSocketAction describes an action based on opening a socket".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "host".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Optional: Host name to connect to, defaults to the pod IP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "port".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/toleration.rs b/src/v1_30/api/core/v1/toleration.rs new file mode 100644 index 000000000..1a79a2088 --- /dev/null +++ b/src/v1_30/api/core/v1/toleration.rs @@ -0,0 +1,228 @@ +// Generated from definition io.k8s.api.core.v1.Toleration + +/// The pod this Toleration is attached to tolerates any taint that matches the triple \ using the matching operator \. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Toleration { + /// Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + pub effect: Option, + + /// Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. + pub key: Option, + + /// Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. + pub operator: Option, + + /// TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. + pub toleration_seconds: Option, + + /// Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string. + pub value: Option, +} + +impl crate::DeepMerge for Toleration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.effect, other.effect); + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.operator, other.operator); + crate::DeepMerge::merge_from(&mut self.toleration_seconds, other.toleration_seconds); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Toleration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_effect, + Key_key, + Key_operator, + Key_toleration_seconds, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "effect" => Field::Key_effect, + "key" => Field::Key_key, + "operator" => Field::Key_operator, + "tolerationSeconds" => Field::Key_toleration_seconds, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Toleration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Toleration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_effect: Option = None; + let mut value_key: Option = None; + let mut value_operator: Option = None; + let mut value_toleration_seconds: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_effect => value_effect = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operator => value_operator = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_toleration_seconds => value_toleration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Toleration { + effect: value_effect, + key: value_key, + operator: value_operator, + toleration_seconds: value_toleration_seconds, + value: value_value, + }) + } + } + + deserializer.deserialize_struct( + "Toleration", + &[ + "effect", + "key", + "operator", + "tolerationSeconds", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Toleration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Toleration", + self.effect.as_ref().map_or(0, |_| 1) + + self.key.as_ref().map_or(0, |_| 1) + + self.operator.as_ref().map_or(0, |_| 1) + + self.toleration_seconds.as_ref().map_or(0, |_| 1) + + self.value.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.effect { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "effect", value)?; + } + if let Some(value) = &self.key { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", value)?; + } + if let Some(value) = &self.operator { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operator", value)?; + } + if let Some(value) = &self.toleration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tolerationSeconds", value)?; + } + if let Some(value) = &self.value { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Toleration { + fn schema_name() -> String { + "io.k8s.api.core.v1.Toleration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator .".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "effect".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operator".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "tolerationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/topology_selector_label_requirement.rs b/src/v1_30/api/core/v1/topology_selector_label_requirement.rs new file mode 100644 index 000000000..50764252b --- /dev/null +++ b/src/v1_30/api/core/v1/topology_selector_label_requirement.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.core.v1.TopologySelectorLabelRequirement + +/// A topology selector requirement is a selector that matches given label. This is an alpha feature and may change in the future. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TopologySelectorLabelRequirement { + /// The label key that the selector applies to. + pub key: String, + + /// An array of string values. One value must match the label to be selected. Each entry in Values is ORed. + pub values: Vec, +} + +impl crate::DeepMerge for TopologySelectorLabelRequirement { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::merge_strategies::list::atomic(&mut self.values, other.values); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TopologySelectorLabelRequirement { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_values, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "values" => Field::Key_values, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TopologySelectorLabelRequirement; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TopologySelectorLabelRequirement") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_values: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_values => value_values = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TopologySelectorLabelRequirement { + key: value_key.unwrap_or_default(), + values: value_values.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "TopologySelectorLabelRequirement", + &[ + "key", + "values", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TopologySelectorLabelRequirement { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TopologySelectorLabelRequirement", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "values", &self.values)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TopologySelectorLabelRequirement { + fn schema_name() -> String { + "io.k8s.api.core.v1.TopologySelectorLabelRequirement".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A topology selector requirement is a selector that matches given label. This is an alpha feature and may change in the future.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The label key that the selector applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "values".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An array of string values. One value must match the label to be selected. Each entry in Values is ORed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "values".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/topology_selector_term.rs b/src/v1_30/api/core/v1/topology_selector_term.rs new file mode 100644 index 000000000..df526d6f4 --- /dev/null +++ b/src/v1_30/api/core/v1/topology_selector_term.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.core.v1.TopologySelectorTerm + +/// A topology selector term represents the result of label queries. A null or empty topology selector term matches no objects. The requirements of them are ANDed. It provides a subset of functionality as NodeSelectorTerm. This is an alpha feature and may change in the future. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TopologySelectorTerm { + /// A list of topology selector requirements by labels. + pub match_label_expressions: Option>, +} + +impl crate::DeepMerge for TopologySelectorTerm { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.match_label_expressions, other.match_label_expressions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TopologySelectorTerm { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_label_expressions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchLabelExpressions" => Field::Key_match_label_expressions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TopologySelectorTerm; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TopologySelectorTerm") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_label_expressions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_label_expressions => value_match_label_expressions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TopologySelectorTerm { + match_label_expressions: value_match_label_expressions, + }) + } + } + + deserializer.deserialize_struct( + "TopologySelectorTerm", + &[ + "matchLabelExpressions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TopologySelectorTerm { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TopologySelectorTerm", + self.match_label_expressions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_label_expressions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchLabelExpressions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TopologySelectorTerm { + fn schema_name() -> String { + "io.k8s.api.core.v1.TopologySelectorTerm".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A topology selector term represents the result of label queries. A null or empty topology selector term matches no objects. The requirements of them are ANDed. It provides a subset of functionality as NodeSelectorTerm. This is an alpha feature and may change in the future.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchLabelExpressions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A list of topology selector requirements by labels.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/topology_spread_constraint.rs b/src/v1_30/api/core/v1/topology_spread_constraint.rs new file mode 100644 index 000000000..25a2ea395 --- /dev/null +++ b/src/v1_30/api/core/v1/topology_spread_constraint.rs @@ -0,0 +1,321 @@ +// Generated from definition io.k8s.api.core.v1.TopologySpreadConstraint + +/// TopologySpreadConstraint specifies how to spread matching pods among the given topology. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TopologySpreadConstraint { + /// LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. + pub label_selector: Option, + + /// MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. + /// + /// This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default). + pub match_label_keys: Option>, + + /// MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. The global minimum is the minimum number of matching pods in an eligible domain or zero if the number of eligible domains is less than MinDomains. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 2/2/1: In this case, the global minimum is 1. | zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It's a required field. Default value is 1 and 0 is not allowed. + pub max_skew: i32, + + /// MinDomains indicates a minimum number of eligible domains. When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won't schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + /// + /// For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew. + pub min_domains: Option, + + /// NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + /// + /// If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + pub node_affinity_policy: Option, + + /// NodeTaintsPolicy indicates how we will treat node taints when calculating pod topology spread skew. Options are: - Honor: nodes without taints, along with tainted nodes for which the incoming pod has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. + /// + /// If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + pub node_taints_policy: Option, + + /// TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each \ as a "bucket", and try to put balanced number of pods into each bucket. We define a domain as a particular instance of a topology. Also, we define an eligible domain as a domain whose nodes meet the requirements of nodeAffinityPolicy and nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. It's a required field. + pub topology_key: String, + + /// WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location, + /// but giving higher precedence to topologies that would help reduce the + /// skew. + /// A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assignment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P | P | P | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won't make it *more* imbalanced. It's a required field. + pub when_unsatisfiable: String, +} + +impl crate::DeepMerge for TopologySpreadConstraint { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.label_selector, other.label_selector); + crate::merge_strategies::list::atomic(&mut self.match_label_keys, other.match_label_keys); + crate::DeepMerge::merge_from(&mut self.max_skew, other.max_skew); + crate::DeepMerge::merge_from(&mut self.min_domains, other.min_domains); + crate::DeepMerge::merge_from(&mut self.node_affinity_policy, other.node_affinity_policy); + crate::DeepMerge::merge_from(&mut self.node_taints_policy, other.node_taints_policy); + crate::DeepMerge::merge_from(&mut self.topology_key, other.topology_key); + crate::DeepMerge::merge_from(&mut self.when_unsatisfiable, other.when_unsatisfiable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TopologySpreadConstraint { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_label_selector, + Key_match_label_keys, + Key_max_skew, + Key_min_domains, + Key_node_affinity_policy, + Key_node_taints_policy, + Key_topology_key, + Key_when_unsatisfiable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "labelSelector" => Field::Key_label_selector, + "matchLabelKeys" => Field::Key_match_label_keys, + "maxSkew" => Field::Key_max_skew, + "minDomains" => Field::Key_min_domains, + "nodeAffinityPolicy" => Field::Key_node_affinity_policy, + "nodeTaintsPolicy" => Field::Key_node_taints_policy, + "topologyKey" => Field::Key_topology_key, + "whenUnsatisfiable" => Field::Key_when_unsatisfiable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TopologySpreadConstraint; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TopologySpreadConstraint") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_label_selector: Option = None; + let mut value_match_label_keys: Option> = None; + let mut value_max_skew: Option = None; + let mut value_min_domains: Option = None; + let mut value_node_affinity_policy: Option = None; + let mut value_node_taints_policy: Option = None; + let mut value_topology_key: Option = None; + let mut value_when_unsatisfiable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_label_selector => value_label_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_label_keys => value_match_label_keys = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_skew => value_max_skew = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_domains => value_min_domains = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_affinity_policy => value_node_affinity_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_taints_policy => value_node_taints_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_topology_key => value_topology_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_when_unsatisfiable => value_when_unsatisfiable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TopologySpreadConstraint { + label_selector: value_label_selector, + match_label_keys: value_match_label_keys, + max_skew: value_max_skew.unwrap_or_default(), + min_domains: value_min_domains, + node_affinity_policy: value_node_affinity_policy, + node_taints_policy: value_node_taints_policy, + topology_key: value_topology_key.unwrap_or_default(), + when_unsatisfiable: value_when_unsatisfiable.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "TopologySpreadConstraint", + &[ + "labelSelector", + "matchLabelKeys", + "maxSkew", + "minDomains", + "nodeAffinityPolicy", + "nodeTaintsPolicy", + "topologyKey", + "whenUnsatisfiable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TopologySpreadConstraint { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TopologySpreadConstraint", + 3 + + self.label_selector.as_ref().map_or(0, |_| 1) + + self.match_label_keys.as_ref().map_or(0, |_| 1) + + self.min_domains.as_ref().map_or(0, |_| 1) + + self.node_affinity_policy.as_ref().map_or(0, |_| 1) + + self.node_taints_policy.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.label_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "labelSelector", value)?; + } + if let Some(value) = &self.match_label_keys { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchLabelKeys", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxSkew", &self.max_skew)?; + if let Some(value) = &self.min_domains { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minDomains", value)?; + } + if let Some(value) = &self.node_affinity_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAffinityPolicy", value)?; + } + if let Some(value) = &self.node_taints_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeTaintsPolicy", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "topologyKey", &self.topology_key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "whenUnsatisfiable", &self.when_unsatisfiable)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TopologySpreadConstraint { + fn schema_name() -> String { + "io.k8s.api.core.v1.TopologySpreadConstraint".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TopologySpreadConstraint specifies how to spread matching pods among the given topology.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "labelSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "matchLabelKeys".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector.\n\nThis is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "maxSkew".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. The global minimum is the minimum number of matching pods in an eligible domain or zero if the number of eligible domains is less than MinDomains. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 2/2/1: In this case, the global minimum is 1. | zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It's a required field. Default value is 1 and 0 is not allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "minDomains".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MinDomains indicates a minimum number of eligible domains. When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats \"global minimum\" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won't schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule.\n\nFor example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so \"global minimum\" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "nodeAffinityPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations.\n\nIf this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeTaintsPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeTaintsPolicy indicates how we will treat node taints when calculating pod topology spread skew. Options are: - Honor: nodes without taints, along with tainted nodes for which the incoming pod has a toleration, are included. - Ignore: node taints are ignored. All nodes are included.\n\nIf this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "topologyKey".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each as a \"bucket\", and try to put balanced number of pods into each bucket. We define a domain as a particular instance of a topology. Also, we define an eligible domain as a domain whose nodes meet the requirements of nodeAffinityPolicy and nodeTaintsPolicy. e.g. If TopologyKey is \"kubernetes.io/hostname\", each Node is a domain of that topology. And, if TopologyKey is \"topology.kubernetes.io/zone\", each zone is a domain of that topology. It's a required field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "whenUnsatisfiable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,\n but giving higher precedence to topologies that would help reduce the\n skew.\nA constraint is considered \"Unsatisfiable\" for an incoming pod if and only if every possible node assignment for that pod would violate \"MaxSkew\" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P | P | P | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won't make it *more* imbalanced. It's a required field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "maxSkew".to_owned(), + "topologyKey".to_owned(), + "whenUnsatisfiable".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/typed_local_object_reference.rs b/src/v1_30/api/core/v1/typed_local_object_reference.rs new file mode 100644 index 000000000..416e17c46 --- /dev/null +++ b/src/v1_30/api/core/v1/typed_local_object_reference.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.core.v1.TypedLocalObjectReference + +/// TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TypedLocalObjectReference { + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + pub api_group: Option, + + /// Kind is the type of resource being referenced + pub kind: String, + + /// Name is the name of resource being referenced + pub name: String, +} + +impl crate::DeepMerge for TypedLocalObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TypedLocalObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TypedLocalObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TypedLocalObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TypedLocalObjectReference { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "TypedLocalObjectReference", + &[ + "apiGroup", + "kind", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TypedLocalObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TypedLocalObjectReference", + 2 + + self.api_group.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TypedLocalObjectReference { + fn schema_name() -> String { + "io.k8s.api.core.v1.TypedLocalObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the type of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/typed_object_reference.rs b/src/v1_30/api/core/v1/typed_object_reference.rs new file mode 100644 index 000000000..1d448751d --- /dev/null +++ b/src/v1_30/api/core/v1/typed_object_reference.rs @@ -0,0 +1,196 @@ +// Generated from definition io.k8s.api.core.v1.TypedObjectReference + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TypedObjectReference { + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + pub api_group: Option, + + /// Kind is the type of resource being referenced + pub kind: String, + + /// Name is the name of resource being referenced + pub name: String, + + /// Namespace is the namespace of resource being referenced Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + pub namespace: Option, +} + +impl crate::DeepMerge for TypedObjectReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TypedObjectReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TypedObjectReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TypedObjectReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TypedObjectReference { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespace: value_namespace, + }) + } + } + + deserializer.deserialize_struct( + "TypedObjectReference", + &[ + "apiGroup", + "kind", + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TypedObjectReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TypedObjectReference", + 2 + + self.api_group.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TypedObjectReference { + fn schema_name() -> String { + "io.k8s.api.core.v1.TypedObjectReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the type of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace is the namespace of resource being referenced Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume.rs b/src/v1_30/api/core/v1/volume.rs new file mode 100644 index 000000000..dcbc58851 --- /dev/null +++ b/src/v1_30/api/core/v1/volume.rs @@ -0,0 +1,866 @@ +// Generated from definition io.k8s.api.core.v1.Volume + +/// Volume represents a named volume in a pod that may be accessed by any container in the pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Volume { + /// awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + pub aws_elastic_block_store: Option, + + /// azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + pub azure_disk: Option, + + /// azureFile represents an Azure File Service mount on the host and bind mount to the pod. + pub azure_file: Option, + + /// cephFS represents a Ceph FS mount on the host that shares a pod's lifetime + pub cephfs: Option, + + /// cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md + pub cinder: Option, + + /// configMap represents a configMap that should populate this volume + pub config_map: Option, + + /// csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). + pub csi: Option, + + /// downwardAPI represents downward API about the pod that should populate this volume + pub downward_api: Option, + + /// emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pub empty_dir: Option, + + /// ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. + /// + /// Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity + /// tracking are needed, + /// c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through + /// a PersistentVolumeClaim (see EphemeralVolumeSource for more + /// information on the connection between this volume type + /// and PersistentVolumeClaim). + /// + /// Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. + /// + /// Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. + /// + /// A pod can use both types of ephemeral volumes and persistent volumes at the same time. + pub ephemeral: Option, + + /// fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + pub fc: Option, + + /// flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. + pub flex_volume: Option, + + /// flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running + pub flocker: Option, + + /// gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + pub gce_persistent_disk: Option, + + /// gitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container. + pub git_repo: Option, + + /// glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md + pub glusterfs: Option, + + /// hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + pub host_path: Option, + + /// iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md + pub iscsi: Option, + + /// name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + pub name: String, + + /// nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + pub nfs: Option, + + /// persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + pub persistent_volume_claim: Option, + + /// photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine + pub photon_persistent_disk: Option, + + /// portworxVolume represents a portworx volume attached and mounted on kubelets host machine + pub portworx_volume: Option, + + /// projected items for all in one resources secrets, configmaps, and downward API + pub projected: Option, + + /// quobyte represents a Quobyte mount on the host that shares a pod's lifetime + pub quobyte: Option, + + /// rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md + pub rbd: Option, + + /// scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + pub scale_io: Option, + + /// secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + pub secret: Option, + + /// storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + pub storageos: Option, + + /// vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine + pub vsphere_volume: Option, +} + +impl crate::DeepMerge for Volume { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.aws_elastic_block_store, other.aws_elastic_block_store); + crate::DeepMerge::merge_from(&mut self.azure_disk, other.azure_disk); + crate::DeepMerge::merge_from(&mut self.azure_file, other.azure_file); + crate::DeepMerge::merge_from(&mut self.cephfs, other.cephfs); + crate::DeepMerge::merge_from(&mut self.cinder, other.cinder); + crate::DeepMerge::merge_from(&mut self.config_map, other.config_map); + crate::DeepMerge::merge_from(&mut self.csi, other.csi); + crate::DeepMerge::merge_from(&mut self.downward_api, other.downward_api); + crate::DeepMerge::merge_from(&mut self.empty_dir, other.empty_dir); + crate::DeepMerge::merge_from(&mut self.ephemeral, other.ephemeral); + crate::DeepMerge::merge_from(&mut self.fc, other.fc); + crate::DeepMerge::merge_from(&mut self.flex_volume, other.flex_volume); + crate::DeepMerge::merge_from(&mut self.flocker, other.flocker); + crate::DeepMerge::merge_from(&mut self.gce_persistent_disk, other.gce_persistent_disk); + crate::DeepMerge::merge_from(&mut self.git_repo, other.git_repo); + crate::DeepMerge::merge_from(&mut self.glusterfs, other.glusterfs); + crate::DeepMerge::merge_from(&mut self.host_path, other.host_path); + crate::DeepMerge::merge_from(&mut self.iscsi, other.iscsi); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.nfs, other.nfs); + crate::DeepMerge::merge_from(&mut self.persistent_volume_claim, other.persistent_volume_claim); + crate::DeepMerge::merge_from(&mut self.photon_persistent_disk, other.photon_persistent_disk); + crate::DeepMerge::merge_from(&mut self.portworx_volume, other.portworx_volume); + crate::DeepMerge::merge_from(&mut self.projected, other.projected); + crate::DeepMerge::merge_from(&mut self.quobyte, other.quobyte); + crate::DeepMerge::merge_from(&mut self.rbd, other.rbd); + crate::DeepMerge::merge_from(&mut self.scale_io, other.scale_io); + crate::DeepMerge::merge_from(&mut self.secret, other.secret); + crate::DeepMerge::merge_from(&mut self.storageos, other.storageos); + crate::DeepMerge::merge_from(&mut self.vsphere_volume, other.vsphere_volume); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Volume { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_aws_elastic_block_store, + Key_azure_disk, + Key_azure_file, + Key_cephfs, + Key_cinder, + Key_config_map, + Key_csi, + Key_downward_api, + Key_empty_dir, + Key_ephemeral, + Key_fc, + Key_flex_volume, + Key_flocker, + Key_gce_persistent_disk, + Key_git_repo, + Key_glusterfs, + Key_host_path, + Key_iscsi, + Key_name, + Key_nfs, + Key_persistent_volume_claim, + Key_photon_persistent_disk, + Key_portworx_volume, + Key_projected, + Key_quobyte, + Key_rbd, + Key_scale_io, + Key_secret, + Key_storageos, + Key_vsphere_volume, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "awsElasticBlockStore" => Field::Key_aws_elastic_block_store, + "azureDisk" => Field::Key_azure_disk, + "azureFile" => Field::Key_azure_file, + "cephfs" => Field::Key_cephfs, + "cinder" => Field::Key_cinder, + "configMap" => Field::Key_config_map, + "csi" => Field::Key_csi, + "downwardAPI" => Field::Key_downward_api, + "emptyDir" => Field::Key_empty_dir, + "ephemeral" => Field::Key_ephemeral, + "fc" => Field::Key_fc, + "flexVolume" => Field::Key_flex_volume, + "flocker" => Field::Key_flocker, + "gcePersistentDisk" => Field::Key_gce_persistent_disk, + "gitRepo" => Field::Key_git_repo, + "glusterfs" => Field::Key_glusterfs, + "hostPath" => Field::Key_host_path, + "iscsi" => Field::Key_iscsi, + "name" => Field::Key_name, + "nfs" => Field::Key_nfs, + "persistentVolumeClaim" => Field::Key_persistent_volume_claim, + "photonPersistentDisk" => Field::Key_photon_persistent_disk, + "portworxVolume" => Field::Key_portworx_volume, + "projected" => Field::Key_projected, + "quobyte" => Field::Key_quobyte, + "rbd" => Field::Key_rbd, + "scaleIO" => Field::Key_scale_io, + "secret" => Field::Key_secret, + "storageos" => Field::Key_storageos, + "vsphereVolume" => Field::Key_vsphere_volume, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Volume; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Volume") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_aws_elastic_block_store: Option = None; + let mut value_azure_disk: Option = None; + let mut value_azure_file: Option = None; + let mut value_cephfs: Option = None; + let mut value_cinder: Option = None; + let mut value_config_map: Option = None; + let mut value_csi: Option = None; + let mut value_downward_api: Option = None; + let mut value_empty_dir: Option = None; + let mut value_ephemeral: Option = None; + let mut value_fc: Option = None; + let mut value_flex_volume: Option = None; + let mut value_flocker: Option = None; + let mut value_gce_persistent_disk: Option = None; + let mut value_git_repo: Option = None; + let mut value_glusterfs: Option = None; + let mut value_host_path: Option = None; + let mut value_iscsi: Option = None; + let mut value_name: Option = None; + let mut value_nfs: Option = None; + let mut value_persistent_volume_claim: Option = None; + let mut value_photon_persistent_disk: Option = None; + let mut value_portworx_volume: Option = None; + let mut value_projected: Option = None; + let mut value_quobyte: Option = None; + let mut value_rbd: Option = None; + let mut value_scale_io: Option = None; + let mut value_secret: Option = None; + let mut value_storageos: Option = None; + let mut value_vsphere_volume: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_aws_elastic_block_store => value_aws_elastic_block_store = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_azure_disk => value_azure_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_azure_file => value_azure_file = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cephfs => value_cephfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cinder => value_cinder = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_config_map => value_config_map = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_csi => value_csi = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_downward_api => value_downward_api = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_empty_dir => value_empty_dir = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ephemeral => value_ephemeral = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fc => value_fc = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_flex_volume => value_flex_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_flocker => value_flocker = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_gce_persistent_disk => value_gce_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_git_repo => value_git_repo = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_glusterfs => value_glusterfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_path => value_host_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_iscsi => value_iscsi = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nfs => value_nfs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_persistent_volume_claim => value_persistent_volume_claim = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_photon_persistent_disk => value_photon_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_portworx_volume => value_portworx_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_projected => value_projected = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_quobyte => value_quobyte = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rbd => value_rbd = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scale_io => value_scale_io = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret => value_secret = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storageos => value_storageos = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vsphere_volume => value_vsphere_volume = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Volume { + aws_elastic_block_store: value_aws_elastic_block_store, + azure_disk: value_azure_disk, + azure_file: value_azure_file, + cephfs: value_cephfs, + cinder: value_cinder, + config_map: value_config_map, + csi: value_csi, + downward_api: value_downward_api, + empty_dir: value_empty_dir, + ephemeral: value_ephemeral, + fc: value_fc, + flex_volume: value_flex_volume, + flocker: value_flocker, + gce_persistent_disk: value_gce_persistent_disk, + git_repo: value_git_repo, + glusterfs: value_glusterfs, + host_path: value_host_path, + iscsi: value_iscsi, + name: value_name.unwrap_or_default(), + nfs: value_nfs, + persistent_volume_claim: value_persistent_volume_claim, + photon_persistent_disk: value_photon_persistent_disk, + portworx_volume: value_portworx_volume, + projected: value_projected, + quobyte: value_quobyte, + rbd: value_rbd, + scale_io: value_scale_io, + secret: value_secret, + storageos: value_storageos, + vsphere_volume: value_vsphere_volume, + }) + } + } + + deserializer.deserialize_struct( + "Volume", + &[ + "awsElasticBlockStore", + "azureDisk", + "azureFile", + "cephfs", + "cinder", + "configMap", + "csi", + "downwardAPI", + "emptyDir", + "ephemeral", + "fc", + "flexVolume", + "flocker", + "gcePersistentDisk", + "gitRepo", + "glusterfs", + "hostPath", + "iscsi", + "name", + "nfs", + "persistentVolumeClaim", + "photonPersistentDisk", + "portworxVolume", + "projected", + "quobyte", + "rbd", + "scaleIO", + "secret", + "storageos", + "vsphereVolume", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Volume { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Volume", + 1 + + self.aws_elastic_block_store.as_ref().map_or(0, |_| 1) + + self.azure_disk.as_ref().map_or(0, |_| 1) + + self.azure_file.as_ref().map_or(0, |_| 1) + + self.cephfs.as_ref().map_or(0, |_| 1) + + self.cinder.as_ref().map_or(0, |_| 1) + + self.config_map.as_ref().map_or(0, |_| 1) + + self.csi.as_ref().map_or(0, |_| 1) + + self.downward_api.as_ref().map_or(0, |_| 1) + + self.empty_dir.as_ref().map_or(0, |_| 1) + + self.ephemeral.as_ref().map_or(0, |_| 1) + + self.fc.as_ref().map_or(0, |_| 1) + + self.flex_volume.as_ref().map_or(0, |_| 1) + + self.flocker.as_ref().map_or(0, |_| 1) + + self.gce_persistent_disk.as_ref().map_or(0, |_| 1) + + self.git_repo.as_ref().map_or(0, |_| 1) + + self.glusterfs.as_ref().map_or(0, |_| 1) + + self.host_path.as_ref().map_or(0, |_| 1) + + self.iscsi.as_ref().map_or(0, |_| 1) + + self.nfs.as_ref().map_or(0, |_| 1) + + self.persistent_volume_claim.as_ref().map_or(0, |_| 1) + + self.photon_persistent_disk.as_ref().map_or(0, |_| 1) + + self.portworx_volume.as_ref().map_or(0, |_| 1) + + self.projected.as_ref().map_or(0, |_| 1) + + self.quobyte.as_ref().map_or(0, |_| 1) + + self.rbd.as_ref().map_or(0, |_| 1) + + self.scale_io.as_ref().map_or(0, |_| 1) + + self.secret.as_ref().map_or(0, |_| 1) + + self.storageos.as_ref().map_or(0, |_| 1) + + self.vsphere_volume.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.aws_elastic_block_store { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "awsElasticBlockStore", value)?; + } + if let Some(value) = &self.azure_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureDisk", value)?; + } + if let Some(value) = &self.azure_file { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureFile", value)?; + } + if let Some(value) = &self.cephfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cephfs", value)?; + } + if let Some(value) = &self.cinder { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cinder", value)?; + } + if let Some(value) = &self.config_map { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMap", value)?; + } + if let Some(value) = &self.csi { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "csi", value)?; + } + if let Some(value) = &self.downward_api { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "downwardAPI", value)?; + } + if let Some(value) = &self.empty_dir { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "emptyDir", value)?; + } + if let Some(value) = &self.ephemeral { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ephemeral", value)?; + } + if let Some(value) = &self.fc { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fc", value)?; + } + if let Some(value) = &self.flex_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flexVolume", value)?; + } + if let Some(value) = &self.flocker { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flocker", value)?; + } + if let Some(value) = &self.gce_persistent_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gcePersistentDisk", value)?; + } + if let Some(value) = &self.git_repo { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitRepo", value)?; + } + if let Some(value) = &self.glusterfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "glusterfs", value)?; + } + if let Some(value) = &self.host_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPath", value)?; + } + if let Some(value) = &self.iscsi { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsi", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.nfs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nfs", value)?; + } + if let Some(value) = &self.persistent_volume_claim { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeClaim", value)?; + } + if let Some(value) = &self.photon_persistent_disk { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "photonPersistentDisk", value)?; + } + if let Some(value) = &self.portworx_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portworxVolume", value)?; + } + if let Some(value) = &self.projected { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "projected", value)?; + } + if let Some(value) = &self.quobyte { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quobyte", value)?; + } + if let Some(value) = &self.rbd { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rbd", value)?; + } + if let Some(value) = &self.scale_io { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleIO", value)?; + } + if let Some(value) = &self.secret { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secret", value)?; + } + if let Some(value) = &self.storageos { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageos", value)?; + } + if let Some(value) = &self.vsphere_volume { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vsphereVolume", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Volume { + fn schema_name() -> String { + "io.k8s.api.core.v1.Volume".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Volume represents a named volume in a pod that may be accessed by any container in the pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "awsElasticBlockStore".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "azureDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "azureFile".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("azureFile represents an Azure File Service mount on the host and bind mount to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "cephfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cephFS represents a Ceph FS mount on the host that shares a pod's lifetime".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "cinder".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "configMap".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("configMap represents a configMap that should populate this volume".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "csi".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature).".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "downwardAPI".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("downwardAPI represents downward API about the pod that should populate this volume".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "emptyDir".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "ephemeral".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.\n\nUse this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity\n tracking are needed,\nc) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through\n a PersistentVolumeClaim (see EphemeralVolumeSource for more\n information on the connection between this volume type\n and PersistentVolumeClaim).\n\nUse PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.\n\nUse CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.\n\nA pod can use both types of ephemeral volumes and persistent volumes at the same time.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "fc".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "flexVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "flocker".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "gcePersistentDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "gitRepo".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("gitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "glusterfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "hostPath".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "iscsi".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nfs".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "persistentVolumeClaim".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "photonPersistentDisk".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "portworxVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("portworxVolume represents a portworx volume attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "projected".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("projected items for all in one resources secrets, configmaps, and downward API".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "quobyte".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("quobyte represents a Quobyte mount on the host that shares a pod's lifetime".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rbd".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scaleIO".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "secret".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "storageos".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "vsphereVolume".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_device.rs b/src/v1_30/api/core/v1/volume_device.rs new file mode 100644 index 000000000..60dc3a882 --- /dev/null +++ b/src/v1_30/api/core/v1/volume_device.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.core.v1.VolumeDevice + +/// volumeDevice describes a mapping of a raw block device within a container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeDevice { + /// devicePath is the path inside of the container that the device will be mapped to. + pub device_path: String, + + /// name must match the name of a persistentVolumeClaim in the pod + pub name: String, +} + +impl crate::DeepMerge for VolumeDevice { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.device_path, other.device_path); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeDevice { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_device_path, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "devicePath" => Field::Key_device_path, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeDevice; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeDevice") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_device_path: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_device_path => value_device_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeDevice { + device_path: value_device_path.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "VolumeDevice", + &[ + "devicePath", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeDevice { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeDevice", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "devicePath", &self.device_path)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeDevice { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeDevice".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeDevice describes a mapping of a raw block device within a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "devicePath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("devicePath is the path inside of the container that the device will be mapped to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name must match the name of a persistentVolumeClaim in the pod".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "devicePath".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_mount.rs b/src/v1_30/api/core/v1/volume_mount.rs new file mode 100644 index 000000000..3a29f50ee --- /dev/null +++ b/src/v1_30/api/core/v1/volume_mount.rs @@ -0,0 +1,284 @@ +// Generated from definition io.k8s.api.core.v1.VolumeMount + +/// VolumeMount describes a mounting of a Volume within a container. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeMount { + /// Path within the container at which the volume should be mounted. Must not contain ':'. + pub mount_path: String, + + /// mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None). + pub mount_propagation: Option, + + /// This must match the Name of a Volume. + pub name: String, + + /// Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false. + pub read_only: Option, + + /// RecursiveReadOnly specifies whether read-only mounts should be handled recursively. + /// + /// If ReadOnly is false, this field has no meaning and must be unspecified. + /// + /// If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. + /// + /// If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). + /// + /// If this field is not specified, it is treated as an equivalent of Disabled. + pub recursive_read_only: Option, + + /// Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root). + pub sub_path: Option, + + /// Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive. + pub sub_path_expr: Option, +} + +impl crate::DeepMerge for VolumeMount { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.mount_path, other.mount_path); + crate::DeepMerge::merge_from(&mut self.mount_propagation, other.mount_propagation); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.recursive_read_only, other.recursive_read_only); + crate::DeepMerge::merge_from(&mut self.sub_path, other.sub_path); + crate::DeepMerge::merge_from(&mut self.sub_path_expr, other.sub_path_expr); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeMount { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_mount_path, + Key_mount_propagation, + Key_name, + Key_read_only, + Key_recursive_read_only, + Key_sub_path, + Key_sub_path_expr, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "mountPath" => Field::Key_mount_path, + "mountPropagation" => Field::Key_mount_propagation, + "name" => Field::Key_name, + "readOnly" => Field::Key_read_only, + "recursiveReadOnly" => Field::Key_recursive_read_only, + "subPath" => Field::Key_sub_path, + "subPathExpr" => Field::Key_sub_path_expr, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeMount; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeMount") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_mount_path: Option = None; + let mut value_mount_propagation: Option = None; + let mut value_name: Option = None; + let mut value_read_only: Option = None; + let mut value_recursive_read_only: Option = None; + let mut value_sub_path: Option = None; + let mut value_sub_path_expr: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_mount_path => value_mount_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mount_propagation => value_mount_propagation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_recursive_read_only => value_recursive_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_sub_path => value_sub_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_sub_path_expr => value_sub_path_expr = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeMount { + mount_path: value_mount_path.unwrap_or_default(), + mount_propagation: value_mount_propagation, + name: value_name.unwrap_or_default(), + read_only: value_read_only, + recursive_read_only: value_recursive_read_only, + sub_path: value_sub_path, + sub_path_expr: value_sub_path_expr, + }) + } + } + + deserializer.deserialize_struct( + "VolumeMount", + &[ + "mountPath", + "mountPropagation", + "name", + "readOnly", + "recursiveReadOnly", + "subPath", + "subPathExpr", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeMount { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeMount", + 2 + + self.mount_propagation.as_ref().map_or(0, |_| 1) + + self.read_only.as_ref().map_or(0, |_| 1) + + self.recursive_read_only.as_ref().map_or(0, |_| 1) + + self.sub_path.as_ref().map_or(0, |_| 1) + + self.sub_path_expr.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountPath", &self.mount_path)?; + if let Some(value) = &self.mount_propagation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountPropagation", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.recursive_read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "recursiveReadOnly", value)?; + } + if let Some(value) = &self.sub_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subPath", value)?; + } + if let Some(value) = &self.sub_path_expr { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subPathExpr", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeMount { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeMount".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeMount describes a mounting of a Volume within a container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "mountPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Path within the container at which the volume should be mounted. Must not contain ':'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "mountPropagation".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("This must match the Name of a Volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "recursiveReadOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RecursiveReadOnly specifies whether read-only mounts should be handled recursively.\n\nIf ReadOnly is false, this field has no meaning and must be unspecified.\n\nIf ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason.\n\nIf this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None).\n\nIf this field is not specified, it is treated as an equivalent of Disabled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "subPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "subPathExpr".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "mountPath".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_mount_status.rs b/src/v1_30/api/core/v1/volume_mount_status.rs new file mode 100644 index 000000000..3a60cb7cd --- /dev/null +++ b/src/v1_30/api/core/v1/volume_mount_status.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.core.v1.VolumeMountStatus + +/// VolumeMountStatus shows status of volume mounts. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeMountStatus { + /// MountPath corresponds to the original VolumeMount. + pub mount_path: String, + + /// Name corresponds to the name of the original VolumeMount. + pub name: String, + + /// ReadOnly corresponds to the original VolumeMount. + pub read_only: Option, + + /// RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, depending on the mount result. + pub recursive_read_only: Option, +} + +impl crate::DeepMerge for VolumeMountStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.mount_path, other.mount_path); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.read_only, other.read_only); + crate::DeepMerge::merge_from(&mut self.recursive_read_only, other.recursive_read_only); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeMountStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_mount_path, + Key_name, + Key_read_only, + Key_recursive_read_only, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "mountPath" => Field::Key_mount_path, + "name" => Field::Key_name, + "readOnly" => Field::Key_read_only, + "recursiveReadOnly" => Field::Key_recursive_read_only, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeMountStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeMountStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_mount_path: Option = None; + let mut value_name: Option = None; + let mut value_read_only: Option = None; + let mut value_recursive_read_only: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_mount_path => value_mount_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_read_only => value_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_recursive_read_only => value_recursive_read_only = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeMountStatus { + mount_path: value_mount_path.unwrap_or_default(), + name: value_name.unwrap_or_default(), + read_only: value_read_only, + recursive_read_only: value_recursive_read_only, + }) + } + } + + deserializer.deserialize_struct( + "VolumeMountStatus", + &[ + "mountPath", + "name", + "readOnly", + "recursiveReadOnly", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeMountStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeMountStatus", + 2 + + self.read_only.as_ref().map_or(0, |_| 1) + + self.recursive_read_only.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountPath", &self.mount_path)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "readOnly", value)?; + } + if let Some(value) = &self.recursive_read_only { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "recursiveReadOnly", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeMountStatus { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeMountStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeMountStatus shows status of volume mounts.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "mountPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MountPath corresponds to the original VolumeMount.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name corresponds to the name of the original VolumeMount.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "readOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReadOnly corresponds to the original VolumeMount.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "recursiveReadOnly".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, depending on the mount result.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "mountPath".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_node_affinity.rs b/src/v1_30/api/core/v1/volume_node_affinity.rs new file mode 100644 index 000000000..dedc79a07 --- /dev/null +++ b/src/v1_30/api/core/v1/volume_node_affinity.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.core.v1.VolumeNodeAffinity + +/// VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeNodeAffinity { + /// required specifies hard node constraints that must be met. + pub required: Option, +} + +impl crate::DeepMerge for VolumeNodeAffinity { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.required, other.required); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeNodeAffinity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_required, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "required" => Field::Key_required, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeNodeAffinity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeNodeAffinity") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_required: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_required => value_required = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeNodeAffinity { + required: value_required, + }) + } + } + + deserializer.deserialize_struct( + "VolumeNodeAffinity", + &[ + "required", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeNodeAffinity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeNodeAffinity", + self.required.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.required { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "required", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeNodeAffinity { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeNodeAffinity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "required".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("required specifies hard node constraints that must be met.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_projection.rs b/src/v1_30/api/core/v1/volume_projection.rs new file mode 100644 index 000000000..f194b5dff --- /dev/null +++ b/src/v1_30/api/core/v1/volume_projection.rs @@ -0,0 +1,233 @@ +// Generated from definition io.k8s.api.core.v1.VolumeProjection + +/// Projection that may be projected along with other supported volume types +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeProjection { + /// ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. + /// + /// Alpha, gated by the ClusterTrustBundleProjection feature gate. + /// + /// ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. + /// + /// Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. The ordering of certificates within the file is arbitrary, and Kubelet may change the order over time. + pub cluster_trust_bundle: Option, + + /// configMap information about the configMap data to project + pub config_map: Option, + + /// downwardAPI information about the downwardAPI data to project + pub downward_api: Option, + + /// secret information about the secret data to project + pub secret: Option, + + /// serviceAccountToken is information about the serviceAccountToken data to project + pub service_account_token: Option, +} + +impl crate::DeepMerge for VolumeProjection { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.cluster_trust_bundle, other.cluster_trust_bundle); + crate::DeepMerge::merge_from(&mut self.config_map, other.config_map); + crate::DeepMerge::merge_from(&mut self.downward_api, other.downward_api); + crate::DeepMerge::merge_from(&mut self.secret, other.secret); + crate::DeepMerge::merge_from(&mut self.service_account_token, other.service_account_token); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeProjection { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_cluster_trust_bundle, + Key_config_map, + Key_downward_api, + Key_secret, + Key_service_account_token, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "clusterTrustBundle" => Field::Key_cluster_trust_bundle, + "configMap" => Field::Key_config_map, + "downwardAPI" => Field::Key_downward_api, + "secret" => Field::Key_secret, + "serviceAccountToken" => Field::Key_service_account_token, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeProjection; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeProjection") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_cluster_trust_bundle: Option = None; + let mut value_config_map: Option = None; + let mut value_downward_api: Option = None; + let mut value_secret: Option = None; + let mut value_service_account_token: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_cluster_trust_bundle => value_cluster_trust_bundle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_config_map => value_config_map = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_downward_api => value_downward_api = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret => value_secret = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_account_token => value_service_account_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeProjection { + cluster_trust_bundle: value_cluster_trust_bundle, + config_map: value_config_map, + downward_api: value_downward_api, + secret: value_secret, + service_account_token: value_service_account_token, + }) + } + } + + deserializer.deserialize_struct( + "VolumeProjection", + &[ + "clusterTrustBundle", + "configMap", + "downwardAPI", + "secret", + "serviceAccountToken", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeProjection { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeProjection", + self.cluster_trust_bundle.as_ref().map_or(0, |_| 1) + + self.config_map.as_ref().map_or(0, |_| 1) + + self.downward_api.as_ref().map_or(0, |_| 1) + + self.secret.as_ref().map_or(0, |_| 1) + + self.service_account_token.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.cluster_trust_bundle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterTrustBundle", value)?; + } + if let Some(value) = &self.config_map { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMap", value)?; + } + if let Some(value) = &self.downward_api { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "downwardAPI", value)?; + } + if let Some(value) = &self.secret { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secret", value)?; + } + if let Some(value) = &self.service_account_token { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccountToken", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeProjection { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeProjection".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Projection that may be projected along with other supported volume types".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "clusterTrustBundle".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file.\n\nAlpha, gated by the ClusterTrustBundleProjection feature gate.\n\nClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector.\n\nKubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. The ordering of certificates within the file is arbitrary, and Kubelet may change the order over time.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "configMap".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("configMap information about the configMap data to project".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "downwardAPI".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("downwardAPI information about the downwardAPI data to project".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "secret".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secret information about the secret data to project".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "serviceAccountToken".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("serviceAccountToken is information about the serviceAccountToken data to project".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/volume_resource_requirements.rs b/src/v1_30/api/core/v1/volume_resource_requirements.rs new file mode 100644 index 000000000..8b5846cd7 --- /dev/null +++ b/src/v1_30/api/core/v1/volume_resource_requirements.rs @@ -0,0 +1,164 @@ +// Generated from definition io.k8s.api.core.v1.VolumeResourceRequirements + +/// VolumeResourceRequirements describes the storage resource requirements for a volume. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeResourceRequirements { + /// Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub limits: Option>, + + /// Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + pub requests: Option>, +} + +impl crate::DeepMerge for VolumeResourceRequirements { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.limits, other.limits, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.requests, other.requests, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeResourceRequirements { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_limits, + Key_requests, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "limits" => Field::Key_limits, + "requests" => Field::Key_requests, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeResourceRequirements; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeResourceRequirements") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_limits: Option> = None; + let mut value_requests: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_limits => value_limits = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_requests => value_requests = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeResourceRequirements { + limits: value_limits, + requests: value_requests, + }) + } + } + + deserializer.deserialize_struct( + "VolumeResourceRequirements", + &[ + "limits", + "requests", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeResourceRequirements { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeResourceRequirements", + self.limits.as_ref().map_or(0, |_| 1) + + self.requests.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.limits { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limits", value)?; + } + if let Some(value) = &self.requests { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requests", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeResourceRequirements { + fn schema_name() -> String { + "io.k8s.api.core.v1.VolumeResourceRequirements".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeResourceRequirements describes the storage resource requirements for a volume.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "limits".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "requests".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/vsphere_virtual_disk_volume_source.rs b/src/v1_30/api/core/v1/vsphere_virtual_disk_volume_source.rs new file mode 100644 index 000000000..ced7f3da5 --- /dev/null +++ b/src/v1_30/api/core/v1/vsphere_virtual_disk_volume_source.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource + +/// Represents a vSphere volume resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VsphereVirtualDiskVolumeSource { + /// fsType is filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + pub fs_type: Option, + + /// storagePolicyID is the storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. + pub storage_policy_id: Option, + + /// storagePolicyName is the storage Policy Based Management (SPBM) profile name. + pub storage_policy_name: Option, + + /// volumePath is the path that identifies vSphere volume vmdk + pub volume_path: String, +} + +impl crate::DeepMerge for VsphereVirtualDiskVolumeSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.fs_type, other.fs_type); + crate::DeepMerge::merge_from(&mut self.storage_policy_id, other.storage_policy_id); + crate::DeepMerge::merge_from(&mut self.storage_policy_name, other.storage_policy_name); + crate::DeepMerge::merge_from(&mut self.volume_path, other.volume_path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VsphereVirtualDiskVolumeSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_fs_type, + Key_storage_policy_id, + Key_storage_policy_name, + Key_volume_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fsType" => Field::Key_fs_type, + "storagePolicyID" => Field::Key_storage_policy_id, + "storagePolicyName" => Field::Key_storage_policy_name, + "volumePath" => Field::Key_volume_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VsphereVirtualDiskVolumeSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VsphereVirtualDiskVolumeSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_fs_type: Option = None; + let mut value_storage_policy_id: Option = None; + let mut value_storage_policy_name: Option = None; + let mut value_volume_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_fs_type => value_fs_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_policy_id => value_storage_policy_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_policy_name => value_storage_policy_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_path => value_volume_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VsphereVirtualDiskVolumeSource { + fs_type: value_fs_type, + storage_policy_id: value_storage_policy_id, + storage_policy_name: value_storage_policy_name, + volume_path: value_volume_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "VsphereVirtualDiskVolumeSource", + &[ + "fsType", + "storagePolicyID", + "storagePolicyName", + "volumePath", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VsphereVirtualDiskVolumeSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VsphereVirtualDiskVolumeSource", + 1 + + self.fs_type.as_ref().map_or(0, |_| 1) + + self.storage_policy_id.as_ref().map_or(0, |_| 1) + + self.storage_policy_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.fs_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsType", value)?; + } + if let Some(value) = &self.storage_policy_id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storagePolicyID", value)?; + } + if let Some(value) = &self.storage_policy_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storagePolicyName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumePath", &self.volume_path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VsphereVirtualDiskVolumeSource { + fn schema_name() -> String { + "io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Represents a vSphere volume resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsType is filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storagePolicyID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storagePolicyID is the storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storagePolicyName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storagePolicyName is the storage Policy Based Management (SPBM) profile name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumePath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumePath is the path that identifies vSphere volume vmdk".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "volumePath".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/weighted_pod_affinity_term.rs b/src/v1_30/api/core/v1/weighted_pod_affinity_term.rs new file mode 100644 index 000000000..09fca6276 --- /dev/null +++ b/src/v1_30/api/core/v1/weighted_pod_affinity_term.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.core.v1.WeightedPodAffinityTerm + +/// The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct WeightedPodAffinityTerm { + /// Required. A pod affinity term, associated with the corresponding weight. + pub pod_affinity_term: crate::api::core::v1::PodAffinityTerm, + + /// weight associated with matching the corresponding podAffinityTerm, in the range 1-100. + pub weight: i32, +} + +impl crate::DeepMerge for WeightedPodAffinityTerm { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.pod_affinity_term, other.pod_affinity_term); + crate::DeepMerge::merge_from(&mut self.weight, other.weight); + } +} + +impl<'de> crate::serde::Deserialize<'de> for WeightedPodAffinityTerm { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_pod_affinity_term, + Key_weight, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "podAffinityTerm" => Field::Key_pod_affinity_term, + "weight" => Field::Key_weight, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WeightedPodAffinityTerm; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WeightedPodAffinityTerm") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_pod_affinity_term: Option = None; + let mut value_weight: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_pod_affinity_term => value_pod_affinity_term = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_weight => value_weight = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(WeightedPodAffinityTerm { + pod_affinity_term: value_pod_affinity_term.unwrap_or_default(), + weight: value_weight.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "WeightedPodAffinityTerm", + &[ + "podAffinityTerm", + "weight", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for WeightedPodAffinityTerm { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WeightedPodAffinityTerm", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podAffinityTerm", &self.pod_affinity_term)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "weight", &self.weight)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WeightedPodAffinityTerm { + fn schema_name() -> String { + "io.k8s.api.core.v1.WeightedPodAffinityTerm".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "podAffinityTerm".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Required. A pod affinity term, associated with the corresponding weight.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "weight".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("weight associated with matching the corresponding podAffinityTerm, in the range 1-100.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "podAffinityTerm".to_owned(), + "weight".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/core/v1/windows_security_context_options.rs b/src/v1_30/api/core/v1/windows_security_context_options.rs new file mode 100644 index 000000000..09c240dc9 --- /dev/null +++ b/src/v1_30/api/core/v1/windows_security_context_options.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.api.core.v1.WindowsSecurityContextOptions + +/// WindowsSecurityContextOptions contain Windows-specific options and credentials. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct WindowsSecurityContextOptions { + /// GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field. + pub gmsa_credential_spec: Option, + + /// GMSACredentialSpecName is the name of the GMSA credential spec to use. + pub gmsa_credential_spec_name: Option, + + /// HostProcess determines if a container should be run as a 'Host Process' container. All of a Pod's containers must have the same effective HostProcess value (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). In addition, if HostProcess is true then HostNetwork must also be set to true. + pub host_process: Option, + + /// The UserName in Windows to run the entrypoint of the container process. Defaults to the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + pub run_as_user_name: Option, +} + +impl crate::DeepMerge for WindowsSecurityContextOptions { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.gmsa_credential_spec, other.gmsa_credential_spec); + crate::DeepMerge::merge_from(&mut self.gmsa_credential_spec_name, other.gmsa_credential_spec_name); + crate::DeepMerge::merge_from(&mut self.host_process, other.host_process); + crate::DeepMerge::merge_from(&mut self.run_as_user_name, other.run_as_user_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for WindowsSecurityContextOptions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_gmsa_credential_spec, + Key_gmsa_credential_spec_name, + Key_host_process, + Key_run_as_user_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "gmsaCredentialSpec" => Field::Key_gmsa_credential_spec, + "gmsaCredentialSpecName" => Field::Key_gmsa_credential_spec_name, + "hostProcess" => Field::Key_host_process, + "runAsUserName" => Field::Key_run_as_user_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WindowsSecurityContextOptions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WindowsSecurityContextOptions") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_gmsa_credential_spec: Option = None; + let mut value_gmsa_credential_spec_name: Option = None; + let mut value_host_process: Option = None; + let mut value_run_as_user_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_gmsa_credential_spec => value_gmsa_credential_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_gmsa_credential_spec_name => value_gmsa_credential_spec_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_host_process => value_host_process = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_run_as_user_name => value_run_as_user_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(WindowsSecurityContextOptions { + gmsa_credential_spec: value_gmsa_credential_spec, + gmsa_credential_spec_name: value_gmsa_credential_spec_name, + host_process: value_host_process, + run_as_user_name: value_run_as_user_name, + }) + } + } + + deserializer.deserialize_struct( + "WindowsSecurityContextOptions", + &[ + "gmsaCredentialSpec", + "gmsaCredentialSpecName", + "hostProcess", + "runAsUserName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for WindowsSecurityContextOptions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WindowsSecurityContextOptions", + self.gmsa_credential_spec.as_ref().map_or(0, |_| 1) + + self.gmsa_credential_spec_name.as_ref().map_or(0, |_| 1) + + self.host_process.as_ref().map_or(0, |_| 1) + + self.run_as_user_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.gmsa_credential_spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gmsaCredentialSpec", value)?; + } + if let Some(value) = &self.gmsa_credential_spec_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gmsaCredentialSpecName", value)?; + } + if let Some(value) = &self.host_process { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostProcess", value)?; + } + if let Some(value) = &self.run_as_user_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "runAsUserName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WindowsSecurityContextOptions { + fn schema_name() -> String { + "io.k8s.api.core.v1.WindowsSecurityContextOptions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WindowsSecurityContextOptions contain Windows-specific options and credentials.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "gmsaCredentialSpec".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gmsaCredentialSpecName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GMSACredentialSpecName is the name of the GMSA credential spec to use.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "hostProcess".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HostProcess determines if a container should be run as a 'Host Process' container. All of a Pod's containers must have the same effective HostProcess value (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). In addition, if HostProcess is true then HostNetwork must also be set to true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "runAsUserName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The UserName in Windows to run the entrypoint of the container process. Defaults to the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/mod.rs b/src/v1_30/api/discovery/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/discovery/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/discovery/v1/endpoint.rs b/src/v1_30/api/discovery/v1/endpoint.rs new file mode 100644 index 000000000..14b9a4c30 --- /dev/null +++ b/src/v1_30/api/discovery/v1/endpoint.rs @@ -0,0 +1,323 @@ +// Generated from definition io.k8s.api.discovery.v1.Endpoint + +/// Endpoint represents a single logical "backend" implementing a service. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Endpoint { + /// addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at least one address but no more than 100. These are all assumed to be fungible and clients may choose to only use the first element. Refer to: https://issue.k8s.io/106267 + pub addresses: Vec, + + /// conditions contains information about the current status of the endpoint. + pub conditions: Option, + + /// deprecatedTopology contains topology information part of the v1beta1 API. This field is deprecated, and will be removed when the v1beta1 API is removed (no sooner than kubernetes v1.24). While this field can hold values, it is not writable through the v1 API, and any attempts to write to it will be silently ignored. Topology information can be found in the zone and nodeName fields instead. + pub deprecated_topology: Option>, + + /// hints contains information associated with how an endpoint should be consumed. + pub hints: Option, + + /// hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation. + pub hostname: Option, + + /// nodeName represents the name of the Node hosting this endpoint. This can be used to determine endpoints local to a Node. + pub node_name: Option, + + /// targetRef is a reference to a Kubernetes object that represents this endpoint. + pub target_ref: Option, + + /// zone is the name of the Zone this endpoint exists in. + pub zone: Option, +} + +impl crate::DeepMerge for Endpoint { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.addresses, other.addresses); + crate::DeepMerge::merge_from(&mut self.conditions, other.conditions); + crate::merge_strategies::map::granular(&mut self.deprecated_topology, other.deprecated_topology, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.hints, other.hints); + crate::DeepMerge::merge_from(&mut self.hostname, other.hostname); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::DeepMerge::merge_from(&mut self.target_ref, other.target_ref); + crate::DeepMerge::merge_from(&mut self.zone, other.zone); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Endpoint { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_addresses, + Key_conditions, + Key_deprecated_topology, + Key_hints, + Key_hostname, + Key_node_name, + Key_target_ref, + Key_zone, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "addresses" => Field::Key_addresses, + "conditions" => Field::Key_conditions, + "deprecatedTopology" => Field::Key_deprecated_topology, + "hints" => Field::Key_hints, + "hostname" => Field::Key_hostname, + "nodeName" => Field::Key_node_name, + "targetRef" => Field::Key_target_ref, + "zone" => Field::Key_zone, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Endpoint; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Endpoint") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_addresses: Option> = None; + let mut value_conditions: Option = None; + let mut value_deprecated_topology: Option> = None; + let mut value_hints: Option = None; + let mut value_hostname: Option = None; + let mut value_node_name: Option = None; + let mut value_target_ref: Option = None; + let mut value_zone: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_addresses => value_addresses = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated_topology => value_deprecated_topology = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_hints => value_hints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_hostname => value_hostname = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_target_ref => value_target_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_zone => value_zone = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Endpoint { + addresses: value_addresses.unwrap_or_default(), + conditions: value_conditions, + deprecated_topology: value_deprecated_topology, + hints: value_hints, + hostname: value_hostname, + node_name: value_node_name, + target_ref: value_target_ref, + zone: value_zone, + }) + } + } + + deserializer.deserialize_struct( + "Endpoint", + &[ + "addresses", + "conditions", + "deprecatedTopology", + "hints", + "hostname", + "nodeName", + "targetRef", + "zone", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Endpoint { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Endpoint", + 1 + + self.conditions.as_ref().map_or(0, |_| 1) + + self.deprecated_topology.as_ref().map_or(0, |_| 1) + + self.hints.as_ref().map_or(0, |_| 1) + + self.hostname.as_ref().map_or(0, |_| 1) + + self.node_name.as_ref().map_or(0, |_| 1) + + self.target_ref.as_ref().map_or(0, |_| 1) + + self.zone.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "addresses", &self.addresses)?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.deprecated_topology { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecatedTopology", value)?; + } + if let Some(value) = &self.hints { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hints", value)?; + } + if let Some(value) = &self.hostname { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostname", value)?; + } + if let Some(value) = &self.node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?; + } + if let Some(value) = &self.target_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "targetRef", value)?; + } + if let Some(value) = &self.zone { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "zone", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Endpoint { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.Endpoint".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Endpoint represents a single logical \"backend\" implementing a service.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "addresses".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at least one address but no more than 100. These are all assumed to be fungible and clients may choose to only use the first element. Refer to: https://issue.k8s.io/106267".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "conditions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions contains information about the current status of the endpoint.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "deprecatedTopology".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecatedTopology contains topology information part of the v1beta1 API. This field is deprecated, and will be removed when the v1beta1 API is removed (no sooner than kubernetes v1.24). While this field can hold values, it is not writable through the v1 API, and any attempts to write to it will be silently ignored. Topology information can be found in the zone and nodeName fields instead.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "hints".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hints contains information associated with how an endpoint should be consumed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "hostname".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeName represents the name of the Node hosting this endpoint. This can be used to determine endpoints local to a Node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "targetRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("targetRef is a reference to a Kubernetes object that represents this endpoint.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "zone".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("zone is the name of the Zone this endpoint exists in.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "addresses".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/endpoint_conditions.rs b/src/v1_30/api/discovery/v1/endpoint_conditions.rs new file mode 100644 index 000000000..6a68bd7f1 --- /dev/null +++ b/src/v1_30/api/discovery/v1/endpoint_conditions.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.discovery.v1.EndpointConditions + +/// EndpointConditions represents the current condition of an endpoint. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointConditions { + /// ready indicates that this endpoint is prepared to receive traffic, according to whatever system is managing the endpoint. A nil value indicates an unknown state. In most cases consumers should interpret this unknown state as ready. For compatibility reasons, ready should never be "true" for terminating endpoints, except when the normal readiness behavior is being explicitly overridden, for example when the associated Service has set the publishNotReadyAddresses flag. + pub ready: Option, + + /// serving is identical to ready except that it is set regardless of the terminating state of endpoints. This condition should be set to true for a ready endpoint that is terminating. If nil, consumers should defer to the ready condition. + pub serving: Option, + + /// terminating indicates that this endpoint is terminating. A nil value indicates an unknown state. Consumers should interpret this unknown state to mean that the endpoint is not terminating. + pub terminating: Option, +} + +impl crate::DeepMerge for EndpointConditions { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ready, other.ready); + crate::DeepMerge::merge_from(&mut self.serving, other.serving); + crate::DeepMerge::merge_from(&mut self.terminating, other.terminating); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointConditions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ready, + Key_serving, + Key_terminating, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ready" => Field::Key_ready, + "serving" => Field::Key_serving, + "terminating" => Field::Key_terminating, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointConditions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointConditions") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ready: Option = None; + let mut value_serving: Option = None; + let mut value_terminating: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ready => value_ready = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_serving => value_serving = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_terminating => value_terminating = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointConditions { + ready: value_ready, + serving: value_serving, + terminating: value_terminating, + }) + } + } + + deserializer.deserialize_struct( + "EndpointConditions", + &[ + "ready", + "serving", + "terminating", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointConditions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointConditions", + self.ready.as_ref().map_or(0, |_| 1) + + self.serving.as_ref().map_or(0, |_| 1) + + self.terminating.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ready { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ready", value)?; + } + if let Some(value) = &self.serving { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serving", value)?; + } + if let Some(value) = &self.terminating { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "terminating", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointConditions { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.EndpointConditions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointConditions represents the current condition of an endpoint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ready".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ready indicates that this endpoint is prepared to receive traffic, according to whatever system is managing the endpoint. A nil value indicates an unknown state. In most cases consumers should interpret this unknown state as ready. For compatibility reasons, ready should never be \"true\" for terminating endpoints, except when the normal readiness behavior is being explicitly overridden, for example when the associated Service has set the publishNotReadyAddresses flag.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "serving".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("serving is identical to ready except that it is set regardless of the terminating state of endpoints. This condition should be set to true for a ready endpoint that is terminating. If nil, consumers should defer to the ready condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "terminating".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("terminating indicates that this endpoint is terminating. A nil value indicates an unknown state. Consumers should interpret this unknown state to mean that the endpoint is not terminating.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/endpoint_hints.rs b/src/v1_30/api/discovery/v1/endpoint_hints.rs new file mode 100644 index 000000000..02cbd8894 --- /dev/null +++ b/src/v1_30/api/discovery/v1/endpoint_hints.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.discovery.v1.EndpointHints + +/// EndpointHints provides hints describing how an endpoint should be consumed. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointHints { + /// forZones indicates the zone(s) this endpoint should be consumed by to enable topology aware routing. + pub for_zones: Option>, +} + +impl crate::DeepMerge for EndpointHints { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.for_zones, other.for_zones); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointHints { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_for_zones, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "forZones" => Field::Key_for_zones, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointHints; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointHints") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_for_zones: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_for_zones => value_for_zones = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointHints { + for_zones: value_for_zones, + }) + } + } + + deserializer.deserialize_struct( + "EndpointHints", + &[ + "forZones", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointHints { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointHints", + self.for_zones.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.for_zones { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "forZones", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointHints { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.EndpointHints".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointHints provides hints describing how an endpoint should be consumed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "forZones".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("forZones indicates the zone(s) this endpoint should be consumed by to enable topology aware routing.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/endpoint_port.rs b/src/v1_30/api/discovery/v1/endpoint_port.rs new file mode 100644 index 000000000..7022959e5 --- /dev/null +++ b/src/v1_30/api/discovery/v1/endpoint_port.rs @@ -0,0 +1,212 @@ +// Generated from definition io.k8s.api.discovery.v1.EndpointPort + +/// EndpointPort represents a Port used by an EndpointSlice +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointPort { + /// The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either: + /// + /// * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). + /// + /// * Kubernetes-defined prefixed names: + /// * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + /// * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + /// * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + /// + /// * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol. + pub app_protocol: Option, + + /// name represents the name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports\[\].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string. + pub name: Option, + + /// port represents the port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer. + pub port: Option, + + /// protocol represents the IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP. + pub protocol: Option, +} + +impl crate::DeepMerge for EndpointPort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.app_protocol, other.app_protocol); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointPort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_app_protocol, + Key_name, + Key_port, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "appProtocol" => Field::Key_app_protocol, + "name" => Field::Key_name, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointPort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EndpointPort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_app_protocol: Option = None; + let mut value_name: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_app_protocol => value_app_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointPort { + app_protocol: value_app_protocol, + name: value_name, + port: value_port, + protocol: value_protocol, + }) + } + } + + deserializer.deserialize_struct( + "EndpointPort", + &[ + "appProtocol", + "name", + "port", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointPort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EndpointPort", + self.app_protocol.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.port.as_ref().map_or(0, |_| 1) + + self.protocol.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.app_protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "appProtocol", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + if let Some(value) = &self.protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointPort { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.EndpointPort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointPort represents a Port used by an EndpointSlice".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "appProtocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either:\n\n* Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names).\n\n* Kubernetes-defined prefixed names:\n * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-\n * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455\n * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455\n\n* Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name represents the name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("port represents the port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("protocol represents the IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/endpoint_slice.rs b/src/v1_30/api/discovery/v1/endpoint_slice.rs new file mode 100644 index 000000000..f13a66d1b --- /dev/null +++ b/src/v1_30/api/discovery/v1/endpoint_slice.rs @@ -0,0 +1,274 @@ +// Generated from definition io.k8s.api.discovery.v1.EndpointSlice + +/// EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct EndpointSlice { + /// addressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name. + pub address_type: String, + + /// endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints. + pub endpoints: Vec, + + /// Standard object's metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates "all ports". Each slice may include a maximum of 100 ports. + pub ports: Option>, +} + +impl crate::Resource for EndpointSlice { + const API_VERSION: &'static str = "discovery.k8s.io/v1"; + const GROUP: &'static str = "discovery.k8s.io"; + const KIND: &'static str = "EndpointSlice"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "endpointslices"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for EndpointSlice { + const LIST_KIND: &'static str = "EndpointSliceList"; +} + +impl crate::Metadata for EndpointSlice { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for EndpointSlice { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.address_type, other.address_type); + crate::merge_strategies::list::atomic(&mut self.endpoints, other.endpoints); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EndpointSlice { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_address_type, + Key_endpoints, + Key_metadata, + Key_ports, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "addressType" => Field::Key_address_type, + "endpoints" => Field::Key_endpoints, + "metadata" => Field::Key_metadata, + "ports" => Field::Key_ports, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EndpointSlice; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_address_type: Option = None; + let mut value_endpoints: Option> = None; + let mut value_metadata: Option = None; + let mut value_ports: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_address_type => value_address_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_endpoints => value_endpoints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EndpointSlice { + address_type: value_address_type.unwrap_or_default(), + endpoints: value_endpoints.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "addressType", + "endpoints", + "metadata", + "ports", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EndpointSlice { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 5 + + self.ports.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "addressType", &self.address_type)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "endpoints", &self.endpoints)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EndpointSlice { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.EndpointSlice".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "addressType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("addressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "endpoints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates \"all ports\". Each slice may include a maximum of 100 ports.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "addressType".to_owned(), + "endpoints".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/for_zone.rs b/src/v1_30/api/discovery/v1/for_zone.rs new file mode 100644 index 000000000..ab418feb2 --- /dev/null +++ b/src/v1_30/api/discovery/v1/for_zone.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.discovery.v1.ForZone + +/// ForZone provides information about which zones should consume this endpoint. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ForZone { + /// name represents the name of the zone. + pub name: String, +} + +impl crate::DeepMerge for ForZone { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ForZone { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ForZone; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ForZone") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ForZone { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ForZone", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ForZone { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ForZone", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ForZone { + fn schema_name() -> String { + "io.k8s.api.discovery.v1.ForZone".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ForZone provides information about which zones should consume this endpoint.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name represents the name of the zone.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/discovery/v1/mod.rs b/src/v1_30/api/discovery/v1/mod.rs new file mode 100644 index 000000000..fea33c6ba --- /dev/null +++ b/src/v1_30/api/discovery/v1/mod.rs @@ -0,0 +1,18 @@ + +mod endpoint; +pub use self::endpoint::Endpoint; + +mod endpoint_conditions; +pub use self::endpoint_conditions::EndpointConditions; + +mod endpoint_hints; +pub use self::endpoint_hints::EndpointHints; + +mod endpoint_port; +pub use self::endpoint_port::EndpointPort; + +mod endpoint_slice; +pub use self::endpoint_slice::EndpointSlice; + +mod for_zone; +pub use self::for_zone::ForZone; diff --git a/src/v1_30/api/events/mod.rs b/src/v1_30/api/events/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/events/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/events/v1/event.rs b/src/v1_30/api/events/v1/event.rs new file mode 100644 index 000000000..ce3627cf1 --- /dev/null +++ b/src/v1_30/api/events/v1/event.rs @@ -0,0 +1,546 @@ +// Generated from definition io.k8s.api.events.v1.Event + +/// Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Event { + /// action is what action was taken/failed regarding to the regarding object. It is machine-readable. This field cannot be empty for new Events and it can have at most 128 characters. + pub action: Option, + + /// deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type. + pub deprecated_count: Option, + + /// deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + pub deprecated_first_timestamp: Option, + + /// deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type. + pub deprecated_last_timestamp: Option, + + /// deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type. + pub deprecated_source: Option, + + /// eventTime is the time when this Event was first observed. It is required. + pub event_time: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// note is a human-readable description of the status of this operation. Maximal length of the note is 1kB, but libraries should be prepared to handle values up to 64kB. + pub note: Option, + + /// reason is why the action was taken. It is human-readable. This field cannot be empty for new Events and it can have at most 128 characters. + pub reason: Option, + + /// regarding contains the object this Event is about. In most cases it's an Object reporting controller implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because it acts on some changes in a ReplicaSet object. + pub regarding: Option, + + /// related is the optional secondary object for more complex actions. E.g. when regarding object triggers a creation or deletion of related object. + pub related: Option, + + /// reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events. + pub reporting_controller: Option, + + /// reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`. This field cannot be empty for new Events and it can have at most 128 characters. + pub reporting_instance: Option, + + /// series is data about the Event series this event represents or nil if it's a singleton Event. + pub series: Option, + + /// type is the type of this event (Normal, Warning), new types could be added in the future. It is machine-readable. This field cannot be empty for new Events. + pub type_: Option, +} + +impl crate::Resource for Event { + const API_VERSION: &'static str = "events.k8s.io/v1"; + const GROUP: &'static str = "events.k8s.io"; + const KIND: &'static str = "Event"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "events"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Event { + const LIST_KIND: &'static str = "EventList"; +} + +impl crate::Metadata for Event { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Event { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.action, other.action); + crate::DeepMerge::merge_from(&mut self.deprecated_count, other.deprecated_count); + crate::DeepMerge::merge_from(&mut self.deprecated_first_timestamp, other.deprecated_first_timestamp); + crate::DeepMerge::merge_from(&mut self.deprecated_last_timestamp, other.deprecated_last_timestamp); + crate::DeepMerge::merge_from(&mut self.deprecated_source, other.deprecated_source); + crate::DeepMerge::merge_from(&mut self.event_time, other.event_time); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.note, other.note); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.regarding, other.regarding); + crate::DeepMerge::merge_from(&mut self.related, other.related); + crate::DeepMerge::merge_from(&mut self.reporting_controller, other.reporting_controller); + crate::DeepMerge::merge_from(&mut self.reporting_instance, other.reporting_instance); + crate::DeepMerge::merge_from(&mut self.series, other.series); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Event { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_action, + Key_deprecated_count, + Key_deprecated_first_timestamp, + Key_deprecated_last_timestamp, + Key_deprecated_source, + Key_event_time, + Key_metadata, + Key_note, + Key_reason, + Key_regarding, + Key_related, + Key_reporting_controller, + Key_reporting_instance, + Key_series, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "action" => Field::Key_action, + "deprecatedCount" => Field::Key_deprecated_count, + "deprecatedFirstTimestamp" => Field::Key_deprecated_first_timestamp, + "deprecatedLastTimestamp" => Field::Key_deprecated_last_timestamp, + "deprecatedSource" => Field::Key_deprecated_source, + "eventTime" => Field::Key_event_time, + "metadata" => Field::Key_metadata, + "note" => Field::Key_note, + "reason" => Field::Key_reason, + "regarding" => Field::Key_regarding, + "related" => Field::Key_related, + "reportingController" => Field::Key_reporting_controller, + "reportingInstance" => Field::Key_reporting_instance, + "series" => Field::Key_series, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Event; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_action: Option = None; + let mut value_deprecated_count: Option = None; + let mut value_deprecated_first_timestamp: Option = None; + let mut value_deprecated_last_timestamp: Option = None; + let mut value_deprecated_source: Option = None; + let mut value_event_time: Option = None; + let mut value_metadata: Option = None; + let mut value_note: Option = None; + let mut value_reason: Option = None; + let mut value_regarding: Option = None; + let mut value_related: Option = None; + let mut value_reporting_controller: Option = None; + let mut value_reporting_instance: Option = None; + let mut value_series: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_action => value_action = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated_count => value_deprecated_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated_first_timestamp => value_deprecated_first_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated_last_timestamp => value_deprecated_last_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated_source => value_deprecated_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_event_time => value_event_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_note => value_note = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_regarding => value_regarding = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_related => value_related = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reporting_controller => value_reporting_controller = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reporting_instance => value_reporting_instance = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_series => value_series = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Event { + action: value_action, + deprecated_count: value_deprecated_count, + deprecated_first_timestamp: value_deprecated_first_timestamp, + deprecated_last_timestamp: value_deprecated_last_timestamp, + deprecated_source: value_deprecated_source, + event_time: value_event_time, + metadata: value_metadata.unwrap_or_default(), + note: value_note, + reason: value_reason, + regarding: value_regarding, + related: value_related, + reporting_controller: value_reporting_controller, + reporting_instance: value_reporting_instance, + series: value_series, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "action", + "deprecatedCount", + "deprecatedFirstTimestamp", + "deprecatedLastTimestamp", + "deprecatedSource", + "eventTime", + "metadata", + "note", + "reason", + "regarding", + "related", + "reportingController", + "reportingInstance", + "series", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Event { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.action.as_ref().map_or(0, |_| 1) + + self.deprecated_count.as_ref().map_or(0, |_| 1) + + self.deprecated_first_timestamp.as_ref().map_or(0, |_| 1) + + self.deprecated_last_timestamp.as_ref().map_or(0, |_| 1) + + self.deprecated_source.as_ref().map_or(0, |_| 1) + + self.event_time.as_ref().map_or(0, |_| 1) + + self.note.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.regarding.as_ref().map_or(0, |_| 1) + + self.related.as_ref().map_or(0, |_| 1) + + self.reporting_controller.as_ref().map_or(0, |_| 1) + + self.reporting_instance.as_ref().map_or(0, |_| 1) + + self.series.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.action { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "action", value)?; + } + if let Some(value) = &self.deprecated_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecatedCount", value)?; + } + if let Some(value) = &self.deprecated_first_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecatedFirstTimestamp", value)?; + } + if let Some(value) = &self.deprecated_last_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecatedLastTimestamp", value)?; + } + if let Some(value) = &self.deprecated_source { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecatedSource", value)?; + } + if let Some(value) = &self.event_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "eventTime", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.note { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "note", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.regarding { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "regarding", value)?; + } + if let Some(value) = &self.related { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "related", value)?; + } + if let Some(value) = &self.reporting_controller { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reportingController", value)?; + } + if let Some(value) = &self.reporting_instance { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reportingInstance", value)?; + } + if let Some(value) = &self.series { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "series", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Event { + fn schema_name() -> String { + "io.k8s.api.events.v1.Event".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "action".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("action is what action was taken/failed regarding to the regarding object. It is machine-readable. This field cannot be empty for new Events and it can have at most 128 characters.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "deprecatedCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "deprecatedFirstTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "deprecatedLastTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "deprecatedSource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "eventTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("eventTime is the time when this Event was first observed. It is required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "note".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("note is a human-readable description of the status of this operation. Maximal length of the note is 1kB, but libraries should be prepared to handle values up to 64kB.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason is why the action was taken. It is human-readable. This field cannot be empty for new Events and it can have at most 128 characters.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "regarding".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("regarding contains the object this Event is about. In most cases it's an Object reporting controller implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because it acts on some changes in a ReplicaSet object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "related".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("related is the optional secondary object for more complex actions. E.g. when regarding object triggers a creation or deletion of related object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "reportingController".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reportingController is the name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. This field cannot be empty for new Events.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reportingInstance".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reportingInstance is the ID of the controller instance, e.g. `kubelet-xyzf`. This field cannot be empty for new Events and it can have at most 128 characters.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "series".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("series is data about the Event series this event represents or nil if it's a singleton Event.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is the type of this event (Normal, Warning), new types could be added in the future. It is machine-readable. This field cannot be empty for new Events.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/events/v1/event_series.rs b/src/v1_30/api/events/v1/event_series.rs new file mode 100644 index 000000000..67d23dc64 --- /dev/null +++ b/src/v1_30/api/events/v1/event_series.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.events.v1.EventSeries + +/// EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time. How often to update the EventSeries is up to the event reporters. The default event reporter in "k8s.io/client-go/tools/events/event_broadcaster.go" shows how this struct is updated on heartbeats and can guide customized reporter implementations. +#[derive(Clone, Debug, PartialEq)] +pub struct EventSeries { + /// count is the number of occurrences in this series up to the last heartbeat time. + pub count: i32, + + /// lastObservedTime is the time when last Event from the series was seen before last heartbeat. + pub last_observed_time: crate::apimachinery::pkg::apis::meta::v1::MicroTime, +} + +impl crate::DeepMerge for EventSeries { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.count, other.count); + crate::DeepMerge::merge_from(&mut self.last_observed_time, other.last_observed_time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for EventSeries { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_count, + Key_last_observed_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "count" => Field::Key_count, + "lastObservedTime" => Field::Key_last_observed_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = EventSeries; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("EventSeries") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_count: Option = None; + let mut value_last_observed_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_count => value_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_last_observed_time => value_last_observed_time = Some(crate::serde::de::MapAccess::next_value(&mut map)?), + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(EventSeries { + count: value_count.unwrap_or_default(), + last_observed_time: value_last_observed_time.ok_or_else(|| crate::serde::de::Error::missing_field("lastObservedTime"))?, + }) + } + } + + deserializer.deserialize_struct( + "EventSeries", + &[ + "count", + "lastObservedTime", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for EventSeries { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "EventSeries", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "count", &self.count)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastObservedTime", &self.last_observed_time)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for EventSeries { + fn schema_name() -> String { + "io.k8s.api.events.v1.EventSeries".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time. How often to update the EventSeries is up to the event reporters. The default event reporter in \"k8s.io/client-go/tools/events/event_broadcaster.go\" shows how this struct is updated on heartbeats and can guide customized reporter implementations.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "count".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("count is the number of occurrences in this series up to the last heartbeat time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lastObservedTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastObservedTime is the time when last Event from the series was seen before last heartbeat.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "count".to_owned(), + "lastObservedTime".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/events/v1/mod.rs b/src/v1_30/api/events/v1/mod.rs new file mode 100644 index 000000000..e1dfabbd9 --- /dev/null +++ b/src/v1_30/api/events/v1/mod.rs @@ -0,0 +1,6 @@ + +mod event; +pub use self::event::Event; + +mod event_series; +pub use self::event_series::EventSeries; diff --git a/src/v1_30/api/flowcontrol/mod.rs b/src/v1_30/api/flowcontrol/mod.rs new file mode 100644 index 000000000..adf8ecda7 --- /dev/null +++ b/src/v1_30/api/flowcontrol/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1beta3; diff --git a/src/v1_30/api/flowcontrol/v1/exempt_priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1/exempt_priority_level_configuration.rs new file mode 100644 index 000000000..64c7e3a1d --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/exempt_priority_level_configuration.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.ExemptPriorityLevelConfiguration + +/// ExemptPriorityLevelConfiguration describes the configurable aspects of the handling of exempt requests. In the mandatory exempt configuration object the values in the fields here can be modified by authorized users, unlike the rest of the `spec`. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExemptPriorityLevelConfiguration { + /// `lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. This value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + /// + /// LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + pub lendable_percent: Option, + + /// `nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats nominally reserved for this priority level. This DOES NOT limit the dispatching from this priority level but affects the other priority levels through the borrowing mechanism. The server's concurrency limit (ServerCL) is divided among all the priority levels in proportion to their NCS values: + /// + /// NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum\[priority level k\] NCS(k) + /// + /// Bigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of zero. + pub nominal_concurrency_shares: Option, +} + +impl crate::DeepMerge for ExemptPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.lendable_percent, other.lendable_percent); + crate::DeepMerge::merge_from(&mut self.nominal_concurrency_shares, other.nominal_concurrency_shares); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExemptPriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_lendable_percent, + Key_nominal_concurrency_shares, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lendablePercent" => Field::Key_lendable_percent, + "nominalConcurrencyShares" => Field::Key_nominal_concurrency_shares, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExemptPriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExemptPriorityLevelConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_lendable_percent: Option = None; + let mut value_nominal_concurrency_shares: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_lendable_percent => value_lendable_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nominal_concurrency_shares => value_nominal_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExemptPriorityLevelConfiguration { + lendable_percent: value_lendable_percent, + nominal_concurrency_shares: value_nominal_concurrency_shares, + }) + } + } + + deserializer.deserialize_struct( + "ExemptPriorityLevelConfiguration", + &[ + "lendablePercent", + "nominalConcurrencyShares", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExemptPriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExemptPriorityLevelConfiguration", + self.lendable_percent.as_ref().map_or(0, |_| 1) + + self.nominal_concurrency_shares.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.lendable_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lendablePercent", value)?; + } + if let Some(value) = &self.nominal_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nominalConcurrencyShares", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExemptPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.ExemptPriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExemptPriorityLevelConfiguration describes the configurable aspects of the handling of exempt requests. In the mandatory exempt configuration object the values in the fields here can be modified by authorized users, unlike the rest of the `spec`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lendablePercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. This value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.\n\nLendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "nominalConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats nominally reserved for this priority level. This DOES NOT limit the dispatching from this priority level but affects the other priority levels through the borrowing mechanism. The server's concurrency limit (ServerCL) is divided among all the priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of zero.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/flow_distinguisher_method.rs b/src/v1_30/api/flowcontrol/v1/flow_distinguisher_method.rs new file mode 100644 index 000000000..4287658fc --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/flow_distinguisher_method.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod + +/// FlowDistinguisherMethod specifies the method of a flow distinguisher. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowDistinguisherMethod { + /// `type` is the type of flow distinguisher method The supported types are "ByUser" and "ByNamespace". Required. + pub type_: String, +} + +impl crate::DeepMerge for FlowDistinguisherMethod { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowDistinguisherMethod { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowDistinguisherMethod; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowDistinguisherMethod") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowDistinguisherMethod { + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "FlowDistinguisherMethod", + &[ + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowDistinguisherMethod { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowDistinguisherMethod", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowDistinguisherMethod { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.FlowDistinguisherMethod".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowDistinguisherMethod specifies the method of a flow distinguisher.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of flow distinguisher method The supported types are \"ByUser\" and \"ByNamespace\". Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/flow_schema.rs b/src/v1_30/api/flowcontrol/v1/flow_schema.rs new file mode 100644 index 000000000..619383a96 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/flow_schema.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.FlowSchema + +/// FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchema { + /// `metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// `spec` is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// `status` is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for FlowSchema { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "FlowSchema"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "flowschemas"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for FlowSchema { + const LIST_KIND: &'static str = "FlowSchemaList"; +} + +impl crate::Metadata for FlowSchema { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for FlowSchema { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchema { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchema; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchema { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchema { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchema { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.FlowSchema".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a \"flow distinguisher\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`spec` is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/flow_schema_condition.rs b/src/v1_30/api/flowcontrol/v1/flow_schema_condition.rs new file mode 100644 index 000000000..c51e0ed3d --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/flow_schema_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.FlowSchemaCondition + +/// FlowSchemaCondition describes conditions for a FlowSchema. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaCondition { + /// `lastTransitionTime` is the last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// `message` is a human-readable message indicating details about last transition. + pub message: Option, + + /// `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// `status` is the status of the condition. Can be True, False, Unknown. Required. + pub status: Option, + + /// `type` is the type of the condition. Required. + pub type_: Option, +} + +impl crate::DeepMerge for FlowSchemaCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaCondition", + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaCondition { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.FlowSchemaCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaCondition describes conditions for a FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lastTransitionTime` is the last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`message` is a human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`reason` is a unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the status of the condition. Can be True, False, Unknown. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of the condition. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/flow_schema_spec.rs b/src/v1_30/api/flowcontrol/v1/flow_schema_spec.rs new file mode 100644 index 000000000..c74463f92 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/flow_schema_spec.rs @@ -0,0 +1,208 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.FlowSchemaSpec + +/// FlowSchemaSpec describes how the FlowSchema's specification looks like. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaSpec { + /// `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. `nil` specifies that the distinguisher is disabled and thus will always be the empty string. + pub distinguisher_method: Option, + + /// `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in \[1,10000\]. Note that if the precedence is not specified, it will be set to 1000 as default. + pub matching_precedence: Option, + + /// `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required. + pub priority_level_configuration: crate::api::flowcontrol::v1::PriorityLevelConfigurationReference, + + /// `rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema. + pub rules: Option>, +} + +impl crate::DeepMerge for FlowSchemaSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.distinguisher_method, other.distinguisher_method); + crate::DeepMerge::merge_from(&mut self.matching_precedence, other.matching_precedence); + crate::DeepMerge::merge_from(&mut self.priority_level_configuration, other.priority_level_configuration); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_distinguisher_method, + Key_matching_precedence, + Key_priority_level_configuration, + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "distinguisherMethod" => Field::Key_distinguisher_method, + "matchingPrecedence" => Field::Key_matching_precedence, + "priorityLevelConfiguration" => Field::Key_priority_level_configuration, + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_distinguisher_method: Option = None; + let mut value_matching_precedence: Option = None; + let mut value_priority_level_configuration: Option = None; + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_distinguisher_method => value_distinguisher_method = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_matching_precedence => value_matching_precedence = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_priority_level_configuration => value_priority_level_configuration = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaSpec { + distinguisher_method: value_distinguisher_method, + matching_precedence: value_matching_precedence, + priority_level_configuration: value_priority_level_configuration.unwrap_or_default(), + rules: value_rules, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaSpec", + &[ + "distinguisherMethod", + "matchingPrecedence", + "priorityLevelConfiguration", + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaSpec", + 1 + + self.distinguisher_method.as_ref().map_or(0, |_| 1) + + self.matching_precedence.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.distinguisher_method { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "distinguisherMethod", value)?; + } + if let Some(value) = &self.matching_precedence { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchingPrecedence", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "priorityLevelConfiguration", &self.priority_level_configuration)?; + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaSpec { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.FlowSchemaSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaSpec describes how the FlowSchema's specification looks like.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "distinguisherMethod".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. `nil` specifies that the distinguisher is disabled and thus will always be the empty string.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "matchingPrecedence".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "priorityLevelConfiguration".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "priorityLevelConfiguration".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/flow_schema_status.rs b/src/v1_30/api/flowcontrol/v1/flow_schema_status.rs new file mode 100644 index 000000000..7d52186f9 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/flow_schema_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.FlowSchemaStatus + +/// FlowSchemaStatus represents the current state of a FlowSchema. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaStatus { + /// `conditions` is a list of the current states of FlowSchema. + pub conditions: Option>, +} + +impl crate::DeepMerge for FlowSchemaStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaStatus { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.FlowSchemaStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaStatus represents the current state of a FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`conditions` is a list of the current states of FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/group_subject.rs b/src/v1_30/api/flowcontrol/v1/group_subject.rs new file mode 100644 index 000000000..9b7df3c3c --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/group_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.GroupSubject + +/// GroupSubject holds detailed information for group-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GroupSubject { + /// name is the user group that matches, or "*" to match all user groups. See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required. + pub name: String, +} + +impl crate::DeepMerge for GroupSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GroupSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GroupSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GroupSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GroupSubject { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "GroupSubject", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GroupSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GroupSubject", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GroupSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.GroupSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GroupSubject holds detailed information for group-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the user group that matches, or \"*\" to match all user groups. See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/limit_response.rs b/src/v1_30/api/flowcontrol/v1/limit_response.rs new file mode 100644 index 000000000..dbf9b642a --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/limit_response.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.LimitResponse + +/// LimitResponse defines how to handle requests that can not be executed right now. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitResponse { + /// `queuing` holds the configuration parameters for queuing. This field may be non-empty only if `type` is `"Queue"`. + pub queuing: Option, + + /// `type` is "Queue" or "Reject". "Queue" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. "Reject" means that requests that can not be executed upon arrival are rejected. Required. + pub type_: String, +} + +impl crate::DeepMerge for LimitResponse { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.queuing, other.queuing); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitResponse { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_queuing, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "queuing" => Field::Key_queuing, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitResponse; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitResponse") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_queuing: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_queuing => value_queuing = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitResponse { + queuing: value_queuing, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "LimitResponse", + &[ + "queuing", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitResponse { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitResponse", + 1 + + self.queuing.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.queuing { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queuing", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitResponse { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.LimitResponse".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitResponse defines how to handle requests that can not be executed right now.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "queuing".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queuing` holds the configuration parameters for queuing. This field may be non-empty only if `type` is `\"Queue\"`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is \"Queue\" or \"Reject\". \"Queue\" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. \"Reject\" means that requests that can not be executed upon arrival are rejected. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/limited_priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1/limited_priority_level_configuration.rs new file mode 100644 index 000000000..eb5c5ea38 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/limited_priority_level_configuration.rs @@ -0,0 +1,221 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.LimitedPriorityLevelConfiguration + +/// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues: +/// - How are requests for this priority level limited? +/// - What should be done with requests that exceed the limit? +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitedPriorityLevelConfiguration { + /// `borrowingLimitPercent`, if present, configures a limit on how many seats this priority level can borrow from other priority levels. The limit is known as this level's BorrowingConcurrencyLimit (BorrowingCL) and is a limit on the total number of seats that this level may borrow at any one time. This field holds the ratio of that limit to the level's nominal concurrency limit. When this field is non-nil, it must hold a non-negative integer and the limit is calculated as follows. + /// + /// BorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 ) + /// + /// The value of this field can be more than 100, implying that this priority level can borrow a number of seats that is greater than its own nominal concurrency limit (NominalCL). When this field is left `nil`, the limit is effectively infinite. + pub borrowing_limit_percent: Option, + + /// `lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. The value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + /// + /// LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + pub lendable_percent: Option, + + /// `limitResponse` indicates what to do with requests that can not be executed right now + pub limit_response: Option, + + /// `nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values: + /// + /// NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum\[priority level k\] NCS(k) + /// + /// Bigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. + /// + /// If not specified, this field defaults to a value of 30. + /// + /// Setting this field to zero supports the construction of a "jail" for this priority level that is used to hold some request(s) + pub nominal_concurrency_shares: Option, +} + +impl crate::DeepMerge for LimitedPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.borrowing_limit_percent, other.borrowing_limit_percent); + crate::DeepMerge::merge_from(&mut self.lendable_percent, other.lendable_percent); + crate::DeepMerge::merge_from(&mut self.limit_response, other.limit_response); + crate::DeepMerge::merge_from(&mut self.nominal_concurrency_shares, other.nominal_concurrency_shares); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitedPriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_borrowing_limit_percent, + Key_lendable_percent, + Key_limit_response, + Key_nominal_concurrency_shares, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "borrowingLimitPercent" => Field::Key_borrowing_limit_percent, + "lendablePercent" => Field::Key_lendable_percent, + "limitResponse" => Field::Key_limit_response, + "nominalConcurrencyShares" => Field::Key_nominal_concurrency_shares, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitedPriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitedPriorityLevelConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_borrowing_limit_percent: Option = None; + let mut value_lendable_percent: Option = None; + let mut value_limit_response: Option = None; + let mut value_nominal_concurrency_shares: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_borrowing_limit_percent => value_borrowing_limit_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lendable_percent => value_lendable_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limit_response => value_limit_response = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nominal_concurrency_shares => value_nominal_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitedPriorityLevelConfiguration { + borrowing_limit_percent: value_borrowing_limit_percent, + lendable_percent: value_lendable_percent, + limit_response: value_limit_response, + nominal_concurrency_shares: value_nominal_concurrency_shares, + }) + } + } + + deserializer.deserialize_struct( + "LimitedPriorityLevelConfiguration", + &[ + "borrowingLimitPercent", + "lendablePercent", + "limitResponse", + "nominalConcurrencyShares", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitedPriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitedPriorityLevelConfiguration", + self.borrowing_limit_percent.as_ref().map_or(0, |_| 1) + + self.lendable_percent.as_ref().map_or(0, |_| 1) + + self.limit_response.as_ref().map_or(0, |_| 1) + + self.nominal_concurrency_shares.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.borrowing_limit_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "borrowingLimitPercent", value)?; + } + if let Some(value) = &self.lendable_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lendablePercent", value)?; + } + if let Some(value) = &self.limit_response { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limitResponse", value)?; + } + if let Some(value) = &self.nominal_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nominalConcurrencyShares", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitedPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.LimitedPriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "borrowingLimitPercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`borrowingLimitPercent`, if present, configures a limit on how many seats this priority level can borrow from other priority levels. The limit is known as this level's BorrowingConcurrencyLimit (BorrowingCL) and is a limit on the total number of seats that this level may borrow at any one time. This field holds the ratio of that limit to the level's nominal concurrency limit. When this field is non-nil, it must hold a non-negative integer and the limit is calculated as follows.\n\nBorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 )\n\nThe value of this field can be more than 100, implying that this priority level can borrow a number of seats that is greater than its own nominal concurrency limit (NominalCL). When this field is left `nil`, the limit is effectively infinite.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lendablePercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. The value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.\n\nLendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "limitResponse".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`limitResponse` indicates what to do with requests that can not be executed right now".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nominalConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level.\n\nIf not specified, this field defaults to a value of 30.\n\nSetting this field to zero supports the construction of a \"jail\" for this priority level that is used to hold some request(s)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/mod.rs b/src/v1_30/api/flowcontrol/v1/mod.rs new file mode 100644 index 000000000..94b4bafaf --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/mod.rs @@ -0,0 +1,63 @@ + +mod exempt_priority_level_configuration; +pub use self::exempt_priority_level_configuration::ExemptPriorityLevelConfiguration; + +mod flow_distinguisher_method; +pub use self::flow_distinguisher_method::FlowDistinguisherMethod; + +mod flow_schema; +pub use self::flow_schema::FlowSchema; + +mod flow_schema_condition; +pub use self::flow_schema_condition::FlowSchemaCondition; + +mod flow_schema_spec; +pub use self::flow_schema_spec::FlowSchemaSpec; + +mod flow_schema_status; +pub use self::flow_schema_status::FlowSchemaStatus; + +mod group_subject; +pub use self::group_subject::GroupSubject; + +mod limit_response; +pub use self::limit_response::LimitResponse; + +mod limited_priority_level_configuration; +pub use self::limited_priority_level_configuration::LimitedPriorityLevelConfiguration; + +mod non_resource_policy_rule; +pub use self::non_resource_policy_rule::NonResourcePolicyRule; + +mod policy_rules_with_subjects; +pub use self::policy_rules_with_subjects::PolicyRulesWithSubjects; + +mod priority_level_configuration; +pub use self::priority_level_configuration::PriorityLevelConfiguration; + +mod priority_level_configuration_condition; +pub use self::priority_level_configuration_condition::PriorityLevelConfigurationCondition; + +mod priority_level_configuration_reference; +pub use self::priority_level_configuration_reference::PriorityLevelConfigurationReference; + +mod priority_level_configuration_spec; +pub use self::priority_level_configuration_spec::PriorityLevelConfigurationSpec; + +mod priority_level_configuration_status; +pub use self::priority_level_configuration_status::PriorityLevelConfigurationStatus; + +mod queuing_configuration; +pub use self::queuing_configuration::QueuingConfiguration; + +mod resource_policy_rule; +pub use self::resource_policy_rule::ResourcePolicyRule; + +mod service_account_subject; +pub use self::service_account_subject::ServiceAccountSubject; + +mod subject; +pub use self::subject::Subject; + +mod user_subject; +pub use self::user_subject::UserSubject; diff --git a/src/v1_30/api/flowcontrol/v1/non_resource_policy_rule.rs b/src/v1_30/api/flowcontrol/v1/non_resource_policy_rule.rs new file mode 100644 index 000000000..037faf1ae --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/non_resource_policy_rule.rs @@ -0,0 +1,175 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.NonResourcePolicyRule + +/// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NonResourcePolicyRule { + /// `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. For example: + /// - "/healthz" is legal + /// - "/hea*" is illegal + /// - "/hea" is legal but matches nothing + /// - "/hea/*" also matches nothing + /// - "/healthz/*" matches all per-component health checks. + /// "*" matches all non-resource urls. if it is present, it must be the only entry. Required. + pub non_resource_urls: Vec, + + /// `verbs` is a list of matching verbs and may not be empty. "*" matches all verbs. If it is present, it must be the only entry. Required. + pub verbs: Vec, +} + +impl crate::DeepMerge for NonResourcePolicyRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.non_resource_urls, other.non_resource_urls); + crate::merge_strategies::list::set(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NonResourcePolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_urls, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceURLs" => Field::Key_non_resource_urls, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NonResourcePolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NonResourcePolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_urls: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_urls => value_non_resource_urls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NonResourcePolicyRule { + non_resource_urls: value_non_resource_urls.unwrap_or_default(), + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NonResourcePolicyRule", + &[ + "nonResourceURLs", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NonResourcePolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NonResourcePolicyRule", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceURLs", &self.non_resource_urls)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NonResourcePolicyRule { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.NonResourcePolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceURLs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. For example:\n - \"/healthz\" is legal\n - \"/hea*\" is illegal\n - \"/hea\" is legal but matches nothing\n - \"/hea/*\" also matches nothing\n - \"/healthz/*\" matches all per-component health checks.\n\"*\" matches all non-resource urls. if it is present, it must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs. If it is present, it must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "nonResourceURLs".to_owned(), + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/policy_rules_with_subjects.rs b/src/v1_30/api/flowcontrol/v1/policy_rules_with_subjects.rs new file mode 100644 index 000000000..164fe081e --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/policy_rules_with_subjects.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PolicyRulesWithSubjects + +/// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PolicyRulesWithSubjects { + /// `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL. + pub non_resource_rules: Option>, + + /// `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. At least one of `resourceRules` and `nonResourceRules` has to be non-empty. + pub resource_rules: Option>, + + /// subjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required. + pub subjects: Vec, +} + +impl crate::DeepMerge for PolicyRulesWithSubjects { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.non_resource_rules, other.non_resource_rules); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + crate::merge_strategies::list::atomic(&mut self.subjects, other.subjects); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PolicyRulesWithSubjects { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_rules, + Key_resource_rules, + Key_subjects, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceRules" => Field::Key_non_resource_rules, + "resourceRules" => Field::Key_resource_rules, + "subjects" => Field::Key_subjects, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PolicyRulesWithSubjects; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PolicyRulesWithSubjects") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_rules: Option> = None; + let mut value_resource_rules: Option> = None; + let mut value_subjects: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_rules => value_non_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subjects => value_subjects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PolicyRulesWithSubjects { + non_resource_rules: value_non_resource_rules, + resource_rules: value_resource_rules, + subjects: value_subjects.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PolicyRulesWithSubjects", + &[ + "nonResourceRules", + "resourceRules", + "subjects", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PolicyRulesWithSubjects { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PolicyRulesWithSubjects", + 1 + + self.non_resource_rules.as_ref().map_or(0, |_| 1) + + self.resource_rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.non_resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceRules", value)?; + } + if let Some(value) = &self.resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subjects", &self.subjects)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PolicyRulesWithSubjects { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PolicyRulesWithSubjects".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. At least one of `resourceRules` and `nonResourceRules` has to be non-empty.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "subjects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("subjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "subjects".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1/priority_level_configuration.rs new file mode 100644 index 000000000..f5cf535f3 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/priority_level_configuration.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PriorityLevelConfiguration + +/// PriorityLevelConfiguration represents the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfiguration { + /// `metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// `spec` is the specification of the desired behavior of a "request-priority". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// `status` is the current status of a "request-priority". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for PriorityLevelConfiguration { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "PriorityLevelConfiguration"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "prioritylevelconfigurations"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for PriorityLevelConfiguration { + const LIST_KIND: &'static str = "PriorityLevelConfigurationList"; +} + +impl crate::Metadata for PriorityLevelConfiguration { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfiguration { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfiguration represents the configuration of a priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`spec` is the specification of the desired behavior of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the current status of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/priority_level_configuration_condition.rs b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_condition.rs new file mode 100644 index 000000000..363aabfec --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationCondition + +/// PriorityLevelConfigurationCondition defines the condition of priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationCondition { + /// `lastTransitionTime` is the last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// `message` is a human-readable message indicating details about last transition. + pub message: Option, + + /// `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// `status` is the status of the condition. Can be True, False, Unknown. Required. + pub status: Option, + + /// `type` is the type of the condition. Required. + pub type_: Option, +} + +impl crate::DeepMerge for PriorityLevelConfigurationCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationCondition", + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationCondition { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationCondition defines the condition of priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lastTransitionTime` is the last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`message` is a human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`reason` is a unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the status of the condition. Can be True, False, Unknown. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of the condition. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/priority_level_configuration_reference.rs b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_reference.rs new file mode 100644 index 000000000..7a36239b7 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_reference.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationReference + +/// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationReference { + /// `name` is the name of the priority level configuration being referenced Required. + pub name: String, +} + +impl crate::DeepMerge for PriorityLevelConfigurationReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationReference { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationReference", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationReference", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationReference { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationReference contains information that points to the \"request-priority\" being used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of the priority level configuration being referenced Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/priority_level_configuration_spec.rs b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_spec.rs new file mode 100644 index 000000000..2d99971ed --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_spec.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationSpec + +/// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationSpec { + /// `exempt` specifies how requests are handled for an exempt priority level. This field MUST be empty if `type` is `"Limited"`. This field MAY be non-empty if `type` is `"Exempt"`. If empty and `type` is `"Exempt"` then the default values for `ExemptPriorityLevelConfiguration` apply. + pub exempt: Option, + + /// `limited` specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if `type` is `"Limited"`. + pub limited: Option, + + /// `type` indicates whether this priority level is subject to limitation on request execution. A value of `"Exempt"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `"Limited"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required. + pub type_: String, +} + +impl crate::DeepMerge for PriorityLevelConfigurationSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.exempt, other.exempt); + crate::DeepMerge::merge_from(&mut self.limited, other.limited); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exempt, + Key_limited, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "exempt" => Field::Key_exempt, + "limited" => Field::Key_limited, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exempt: Option = None; + let mut value_limited: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exempt => value_exempt = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limited => value_limited = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationSpec { + exempt: value_exempt, + limited: value_limited, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationSpec", + &[ + "exempt", + "limited", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationSpec", + 1 + + self.exempt.as_ref().map_or(0, |_| 1) + + self.limited.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exempt { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exempt", value)?; + } + if let Some(value) = &self.limited { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limited", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationSpec { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationSpec specifies the configuration of a priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "exempt".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`exempt` specifies how requests are handled for an exempt priority level. This field MUST be empty if `type` is `\"Limited\"`. This field MAY be non-empty if `type` is `\"Exempt\"`. If empty and `type` is `\"Exempt\"` then the default values for `ExemptPriorityLevelConfiguration` apply.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "limited".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`limited` specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if `type` is `\"Limited\"`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` indicates whether this priority level is subject to limitation on request execution. A value of `\"Exempt\"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `\"Limited\"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/priority_level_configuration_status.rs b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_status.rs new file mode 100644 index 000000000..f6aefaf74 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/priority_level_configuration_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationStatus + +/// PriorityLevelConfigurationStatus represents the current state of a "request-priority". +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationStatus { + /// `conditions` is the current state of "request-priority". + pub conditions: Option>, +} + +impl crate::DeepMerge for PriorityLevelConfigurationStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationStatus { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.PriorityLevelConfigurationStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationStatus represents the current state of a \"request-priority\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`conditions` is the current state of \"request-priority\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/queuing_configuration.rs b/src/v1_30/api/flowcontrol/v1/queuing_configuration.rs new file mode 100644 index 000000000..495d7b0a1 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/queuing_configuration.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.QueuingConfiguration + +/// QueuingConfiguration holds the configuration parameters for queuing +#[derive(Clone, Debug, Default, PartialEq)] +pub struct QueuingConfiguration { + /// `handSize` is a small positive number that configures the shuffle sharding of requests into queues. When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8. + pub hand_size: Option, + + /// `queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50. + pub queue_length_limit: Option, + + /// `queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64. + pub queues: Option, +} + +impl crate::DeepMerge for QueuingConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.hand_size, other.hand_size); + crate::DeepMerge::merge_from(&mut self.queue_length_limit, other.queue_length_limit); + crate::DeepMerge::merge_from(&mut self.queues, other.queues); + } +} + +impl<'de> crate::serde::Deserialize<'de> for QueuingConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hand_size, + Key_queue_length_limit, + Key_queues, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "handSize" => Field::Key_hand_size, + "queueLengthLimit" => Field::Key_queue_length_limit, + "queues" => Field::Key_queues, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = QueuingConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("QueuingConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hand_size: Option = None; + let mut value_queue_length_limit: Option = None; + let mut value_queues: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hand_size => value_hand_size = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_queue_length_limit => value_queue_length_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_queues => value_queues = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(QueuingConfiguration { + hand_size: value_hand_size, + queue_length_limit: value_queue_length_limit, + queues: value_queues, + }) + } + } + + deserializer.deserialize_struct( + "QueuingConfiguration", + &[ + "handSize", + "queueLengthLimit", + "queues", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for QueuingConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "QueuingConfiguration", + self.hand_size.as_ref().map_or(0, |_| 1) + + self.queue_length_limit.as_ref().map_or(0, |_| 1) + + self.queues.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hand_size { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "handSize", value)?; + } + if let Some(value) = &self.queue_length_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queueLengthLimit", value)?; + } + if let Some(value) = &self.queues { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queues", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for QueuingConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.QueuingConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("QueuingConfiguration holds the configuration parameters for queuing".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "handSize".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`handSize` is a small positive number that configures the shuffle sharding of requests into queues. When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "queueLengthLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "queues".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/resource_policy_rule.rs b/src/v1_30/api/flowcontrol/v1/resource_policy_rule.rs new file mode 100644 index 000000000..27997e7ba --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/resource_policy_rule.rs @@ -0,0 +1,260 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.ResourcePolicyRule + +/// ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==""`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourcePolicyRule { + /// `apiGroups` is a list of matching API groups and may not be empty. "*" matches all API groups and, if present, must be the only entry. Required. + pub api_groups: Vec, + + /// `clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). If this field is omitted or false then the `namespaces` field must contain a non-empty list. + pub cluster_scope: Option, + + /// `namespaces` is a list of target namespaces that restricts matches. A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains "*". Note that "*" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true. + pub namespaces: Option>, + + /// `resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, \[ "services", "nodes/status" \]. This list may not be empty. "*" matches all resources and, if present, must be the only entry. Required. + pub resources: Vec, + + /// `verbs` is a list of matching verbs and may not be empty. "*" matches all verbs and, if present, must be the only entry. Required. + pub verbs: Vec, +} + +impl crate::DeepMerge for ResourcePolicyRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.cluster_scope, other.cluster_scope); + crate::merge_strategies::list::set(&mut self.namespaces, other.namespaces); + crate::merge_strategies::list::set(&mut self.resources, other.resources); + crate::merge_strategies::list::set(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourcePolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_cluster_scope, + Key_namespaces, + Key_resources, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "clusterScope" => Field::Key_cluster_scope, + "namespaces" => Field::Key_namespaces, + "resources" => Field::Key_resources, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourcePolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourcePolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_cluster_scope: Option = None; + let mut value_namespaces: Option> = None; + let mut value_resources: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cluster_scope => value_cluster_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespaces => value_namespaces = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourcePolicyRule { + api_groups: value_api_groups.unwrap_or_default(), + cluster_scope: value_cluster_scope, + namespaces: value_namespaces, + resources: value_resources.unwrap_or_default(), + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourcePolicyRule", + &[ + "apiGroups", + "clusterScope", + "namespaces", + "resources", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourcePolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourcePolicyRule", + 3 + + self.cluster_scope.as_ref().map_or(0, |_| 1) + + self.namespaces.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", &self.api_groups)?; + if let Some(value) = &self.cluster_scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterScope", value)?; + } + if let Some(value) = &self.namespaces { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaces", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", &self.resources)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourcePolicyRule { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.ResourcePolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==\"\"`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`apiGroups` is a list of matching API groups and may not be empty. \"*\" matches all API groups and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "clusterScope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). If this field is omitted or false then the `namespaces` field must contain a non-empty list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "namespaces".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`namespaces` is a list of target namespaces that restricts matches. A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains \"*\". Note that \"*\" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, [ \"services\", \"nodes/status\" ]. This list may not be empty. \"*\" matches all resources and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "apiGroups".to_owned(), + "resources".to_owned(), + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/service_account_subject.rs b/src/v1_30/api/flowcontrol/v1/service_account_subject.rs new file mode 100644 index 000000000..f490bca77 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/service_account_subject.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.ServiceAccountSubject + +/// ServiceAccountSubject holds detailed information for service-account-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceAccountSubject { + /// `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. Required. + pub name: String, + + /// `namespace` is the namespace of matching ServiceAccount objects. Required. + pub namespace: String, +} + +impl crate::DeepMerge for ServiceAccountSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceAccountSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceAccountSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceAccountSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceAccountSubject { + name: value_name.unwrap_or_default(), + namespace: value_namespace.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ServiceAccountSubject", + &[ + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceAccountSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceAccountSubject", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", &self.namespace)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceAccountSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.ServiceAccountSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceAccountSubject holds detailed information for service-account-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of matching ServiceAccount objects, or \"*\" to match regardless of name. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`namespace` is the namespace of matching ServiceAccount objects. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "namespace".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/subject.rs b/src/v1_30/api/flowcontrol/v1/subject.rs new file mode 100644 index 000000000..db84c27d8 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/subject.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.Subject + +/// Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Subject { + /// `group` matches based on user group name. + pub group: Option, + + /// `kind` indicates which one of the other fields is non-empty. Required + pub kind: String, + + /// `serviceAccount` matches ServiceAccounts. + pub service_account: Option, + + /// `user` matches based on username. + pub user: Option, +} + +impl crate::DeepMerge for Subject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.service_account, other.service_account); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Subject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_kind, + Key_service_account, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "kind" => Field::Key_kind, + "serviceAccount" => Field::Key_service_account, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Subject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Subject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_kind: Option = None; + let mut value_service_account: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_account => value_service_account = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Subject { + group: value_group, + kind: value_kind.unwrap_or_default(), + service_account: value_service_account, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "Subject", + &[ + "group", + "kind", + "serviceAccount", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Subject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Subject", + 1 + + self.group.as_ref().map_or(0, |_| 1) + + self.service_account.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + if let Some(value) = &self.service_account { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccount", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Subject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.Subject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`group` matches based on user group name.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`kind` indicates which one of the other fields is non-empty. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "serviceAccount".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`serviceAccount` matches ServiceAccounts.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`user` matches based on username.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "kind".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1/user_subject.rs b/src/v1_30/api/flowcontrol/v1/user_subject.rs new file mode 100644 index 000000000..799f6c794 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1/user_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1.UserSubject + +/// UserSubject holds detailed information for user-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct UserSubject { + /// `name` is the username that matches, or "*" to match all usernames. Required. + pub name: String, +} + +impl crate::DeepMerge for UserSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for UserSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = UserSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("UserSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(UserSubject { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "UserSubject", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for UserSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "UserSubject", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for UserSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1.UserSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UserSubject holds detailed information for user-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the username that matches, or \"*\" to match all usernames. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/exempt_priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1beta3/exempt_priority_level_configuration.rs new file mode 100644 index 000000000..b8b14faa9 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/exempt_priority_level_configuration.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.ExemptPriorityLevelConfiguration + +/// ExemptPriorityLevelConfiguration describes the configurable aspects of the handling of exempt requests. In the mandatory exempt configuration object the values in the fields here can be modified by authorized users, unlike the rest of the `spec`. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExemptPriorityLevelConfiguration { + /// `lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. This value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + /// + /// LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + pub lendable_percent: Option, + + /// `nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats nominally reserved for this priority level. This DOES NOT limit the dispatching from this priority level but affects the other priority levels through the borrowing mechanism. The server's concurrency limit (ServerCL) is divided among all the priority levels in proportion to their NCS values: + /// + /// NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum\[priority level k\] NCS(k) + /// + /// Bigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of zero. + pub nominal_concurrency_shares: Option, +} + +impl crate::DeepMerge for ExemptPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.lendable_percent, other.lendable_percent); + crate::DeepMerge::merge_from(&mut self.nominal_concurrency_shares, other.nominal_concurrency_shares); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExemptPriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_lendable_percent, + Key_nominal_concurrency_shares, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lendablePercent" => Field::Key_lendable_percent, + "nominalConcurrencyShares" => Field::Key_nominal_concurrency_shares, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExemptPriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExemptPriorityLevelConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_lendable_percent: Option = None; + let mut value_nominal_concurrency_shares: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_lendable_percent => value_lendable_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nominal_concurrency_shares => value_nominal_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExemptPriorityLevelConfiguration { + lendable_percent: value_lendable_percent, + nominal_concurrency_shares: value_nominal_concurrency_shares, + }) + } + } + + deserializer.deserialize_struct( + "ExemptPriorityLevelConfiguration", + &[ + "lendablePercent", + "nominalConcurrencyShares", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExemptPriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExemptPriorityLevelConfiguration", + self.lendable_percent.as_ref().map_or(0, |_| 1) + + self.nominal_concurrency_shares.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.lendable_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lendablePercent", value)?; + } + if let Some(value) = &self.nominal_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nominalConcurrencyShares", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExemptPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.ExemptPriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExemptPriorityLevelConfiguration describes the configurable aspects of the handling of exempt requests. In the mandatory exempt configuration object the values in the fields here can be modified by authorized users, unlike the rest of the `spec`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lendablePercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. This value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.\n\nLendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "nominalConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats nominally reserved for this priority level. This DOES NOT limit the dispatching from this priority level but affects the other priority levels through the borrowing mechanism. The server's concurrency limit (ServerCL) is divided among all the priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of zero.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/flow_distinguisher_method.rs b/src/v1_30/api/flowcontrol/v1beta3/flow_distinguisher_method.rs new file mode 100644 index 000000000..0302ced36 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/flow_distinguisher_method.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.FlowDistinguisherMethod + +/// FlowDistinguisherMethod specifies the method of a flow distinguisher. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowDistinguisherMethod { + /// `type` is the type of flow distinguisher method The supported types are "ByUser" and "ByNamespace". Required. + pub type_: String, +} + +impl crate::DeepMerge for FlowDistinguisherMethod { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowDistinguisherMethod { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowDistinguisherMethod; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowDistinguisherMethod") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowDistinguisherMethod { + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "FlowDistinguisherMethod", + &[ + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowDistinguisherMethod { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowDistinguisherMethod", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowDistinguisherMethod { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.FlowDistinguisherMethod".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowDistinguisherMethod specifies the method of a flow distinguisher.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of flow distinguisher method The supported types are \"ByUser\" and \"ByNamespace\". Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/flow_schema.rs b/src/v1_30/api/flowcontrol/v1beta3/flow_schema.rs new file mode 100644 index 000000000..4c0d0a63d --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/flow_schema.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.FlowSchema + +/// FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher". +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchema { + /// `metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// `spec` is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// `status` is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for FlowSchema { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "FlowSchema"; + const VERSION: &'static str = "v1beta3"; + const URL_PATH_SEGMENT: &'static str = "flowschemas"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for FlowSchema { + const LIST_KIND: &'static str = "FlowSchemaList"; +} + +impl crate::Metadata for FlowSchema { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for FlowSchema { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchema { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchema; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchema { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchema { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchema { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.FlowSchema".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a \"flow distinguisher\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`spec` is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/flow_schema_condition.rs b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_condition.rs new file mode 100644 index 000000000..47b330760 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.FlowSchemaCondition + +/// FlowSchemaCondition describes conditions for a FlowSchema. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaCondition { + /// `lastTransitionTime` is the last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// `message` is a human-readable message indicating details about last transition. + pub message: Option, + + /// `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// `status` is the status of the condition. Can be True, False, Unknown. Required. + pub status: Option, + + /// `type` is the type of the condition. Required. + pub type_: Option, +} + +impl crate::DeepMerge for FlowSchemaCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaCondition", + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaCondition { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.FlowSchemaCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaCondition describes conditions for a FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lastTransitionTime` is the last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`message` is a human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`reason` is a unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the status of the condition. Can be True, False, Unknown. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of the condition. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/flow_schema_spec.rs b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_spec.rs new file mode 100644 index 000000000..e03e77fc5 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_spec.rs @@ -0,0 +1,208 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.FlowSchemaSpec + +/// FlowSchemaSpec describes how the FlowSchema's specification looks like. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaSpec { + /// `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. `nil` specifies that the distinguisher is disabled and thus will always be the empty string. + pub distinguisher_method: Option, + + /// `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in \[1,10000\]. Note that if the precedence is not specified, it will be set to 1000 as default. + pub matching_precedence: Option, + + /// `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required. + pub priority_level_configuration: crate::api::flowcontrol::v1beta3::PriorityLevelConfigurationReference, + + /// `rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema. + pub rules: Option>, +} + +impl crate::DeepMerge for FlowSchemaSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.distinguisher_method, other.distinguisher_method); + crate::DeepMerge::merge_from(&mut self.matching_precedence, other.matching_precedence); + crate::DeepMerge::merge_from(&mut self.priority_level_configuration, other.priority_level_configuration); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_distinguisher_method, + Key_matching_precedence, + Key_priority_level_configuration, + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "distinguisherMethod" => Field::Key_distinguisher_method, + "matchingPrecedence" => Field::Key_matching_precedence, + "priorityLevelConfiguration" => Field::Key_priority_level_configuration, + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_distinguisher_method: Option = None; + let mut value_matching_precedence: Option = None; + let mut value_priority_level_configuration: Option = None; + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_distinguisher_method => value_distinguisher_method = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_matching_precedence => value_matching_precedence = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_priority_level_configuration => value_priority_level_configuration = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaSpec { + distinguisher_method: value_distinguisher_method, + matching_precedence: value_matching_precedence, + priority_level_configuration: value_priority_level_configuration.unwrap_or_default(), + rules: value_rules, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaSpec", + &[ + "distinguisherMethod", + "matchingPrecedence", + "priorityLevelConfiguration", + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaSpec", + 1 + + self.distinguisher_method.as_ref().map_or(0, |_| 1) + + self.matching_precedence.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.distinguisher_method { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "distinguisherMethod", value)?; + } + if let Some(value) = &self.matching_precedence { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchingPrecedence", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "priorityLevelConfiguration", &self.priority_level_configuration)?; + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaSpec { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.FlowSchemaSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaSpec describes how the FlowSchema's specification looks like.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "distinguisherMethod".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. `nil` specifies that the distinguisher is disabled and thus will always be the empty string.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "matchingPrecedence".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "priorityLevelConfiguration".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "priorityLevelConfiguration".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/flow_schema_status.rs b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_status.rs new file mode 100644 index 000000000..5ca9e73ef --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/flow_schema_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.FlowSchemaStatus + +/// FlowSchemaStatus represents the current state of a FlowSchema. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FlowSchemaStatus { + /// `conditions` is a list of the current states of FlowSchema. + pub conditions: Option>, +} + +impl crate::DeepMerge for FlowSchemaStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FlowSchemaStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FlowSchemaStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FlowSchemaStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(FlowSchemaStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "FlowSchemaStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for FlowSchemaStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "FlowSchemaStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FlowSchemaStatus { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.FlowSchemaStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FlowSchemaStatus represents the current state of a FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`conditions` is a list of the current states of FlowSchema.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/group_subject.rs b/src/v1_30/api/flowcontrol/v1beta3/group_subject.rs new file mode 100644 index 000000000..ae0258d40 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/group_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.GroupSubject + +/// GroupSubject holds detailed information for group-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GroupSubject { + /// name is the user group that matches, or "*" to match all user groups. See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required. + pub name: String, +} + +impl crate::DeepMerge for GroupSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GroupSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GroupSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GroupSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GroupSubject { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "GroupSubject", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GroupSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GroupSubject", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GroupSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.GroupSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GroupSubject holds detailed information for group-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the user group that matches, or \"*\" to match all user groups. See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/limit_response.rs b/src/v1_30/api/flowcontrol/v1beta3/limit_response.rs new file mode 100644 index 000000000..c1df82627 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/limit_response.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.LimitResponse + +/// LimitResponse defines how to handle requests that can not be executed right now. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitResponse { + /// `queuing` holds the configuration parameters for queuing. This field may be non-empty only if `type` is `"Queue"`. + pub queuing: Option, + + /// `type` is "Queue" or "Reject". "Queue" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. "Reject" means that requests that can not be executed upon arrival are rejected. Required. + pub type_: String, +} + +impl crate::DeepMerge for LimitResponse { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.queuing, other.queuing); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitResponse { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_queuing, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "queuing" => Field::Key_queuing, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitResponse; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitResponse") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_queuing: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_queuing => value_queuing = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitResponse { + queuing: value_queuing, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "LimitResponse", + &[ + "queuing", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitResponse { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitResponse", + 1 + + self.queuing.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.queuing { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queuing", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitResponse { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.LimitResponse".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitResponse defines how to handle requests that can not be executed right now.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "queuing".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queuing` holds the configuration parameters for queuing. This field may be non-empty only if `type` is `\"Queue\"`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is \"Queue\" or \"Reject\". \"Queue\" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. \"Reject\" means that requests that can not be executed upon arrival are rejected. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/limited_priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1beta3/limited_priority_level_configuration.rs new file mode 100644 index 000000000..d4017f462 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/limited_priority_level_configuration.rs @@ -0,0 +1,217 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.LimitedPriorityLevelConfiguration + +/// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues: +/// - How are requests for this priority level limited? +/// - What should be done with requests that exceed the limit? +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LimitedPriorityLevelConfiguration { + /// `borrowingLimitPercent`, if present, configures a limit on how many seats this priority level can borrow from other priority levels. The limit is known as this level's BorrowingConcurrencyLimit (BorrowingCL) and is a limit on the total number of seats that this level may borrow at any one time. This field holds the ratio of that limit to the level's nominal concurrency limit. When this field is non-nil, it must hold a non-negative integer and the limit is calculated as follows. + /// + /// BorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 ) + /// + /// The value of this field can be more than 100, implying that this priority level can borrow a number of seats that is greater than its own nominal concurrency limit (NominalCL). When this field is left `nil`, the limit is effectively infinite. + pub borrowing_limit_percent: Option, + + /// `lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. The value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows. + /// + /// LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 ) + pub lendable_percent: Option, + + /// `limitResponse` indicates what to do with requests that can not be executed right now + pub limit_response: Option, + + /// `nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values: + /// + /// NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum\[priority level k\] NCS(k) + /// + /// Bigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of 30. + pub nominal_concurrency_shares: Option, +} + +impl crate::DeepMerge for LimitedPriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.borrowing_limit_percent, other.borrowing_limit_percent); + crate::DeepMerge::merge_from(&mut self.lendable_percent, other.lendable_percent); + crate::DeepMerge::merge_from(&mut self.limit_response, other.limit_response); + crate::DeepMerge::merge_from(&mut self.nominal_concurrency_shares, other.nominal_concurrency_shares); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LimitedPriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_borrowing_limit_percent, + Key_lendable_percent, + Key_limit_response, + Key_nominal_concurrency_shares, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "borrowingLimitPercent" => Field::Key_borrowing_limit_percent, + "lendablePercent" => Field::Key_lendable_percent, + "limitResponse" => Field::Key_limit_response, + "nominalConcurrencyShares" => Field::Key_nominal_concurrency_shares, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LimitedPriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LimitedPriorityLevelConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_borrowing_limit_percent: Option = None; + let mut value_lendable_percent: Option = None; + let mut value_limit_response: Option = None; + let mut value_nominal_concurrency_shares: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_borrowing_limit_percent => value_borrowing_limit_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_lendable_percent => value_lendable_percent = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limit_response => value_limit_response = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nominal_concurrency_shares => value_nominal_concurrency_shares = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LimitedPriorityLevelConfiguration { + borrowing_limit_percent: value_borrowing_limit_percent, + lendable_percent: value_lendable_percent, + limit_response: value_limit_response, + nominal_concurrency_shares: value_nominal_concurrency_shares, + }) + } + } + + deserializer.deserialize_struct( + "LimitedPriorityLevelConfiguration", + &[ + "borrowingLimitPercent", + "lendablePercent", + "limitResponse", + "nominalConcurrencyShares", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LimitedPriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LimitedPriorityLevelConfiguration", + self.borrowing_limit_percent.as_ref().map_or(0, |_| 1) + + self.lendable_percent.as_ref().map_or(0, |_| 1) + + self.limit_response.as_ref().map_or(0, |_| 1) + + self.nominal_concurrency_shares.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.borrowing_limit_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "borrowingLimitPercent", value)?; + } + if let Some(value) = &self.lendable_percent { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lendablePercent", value)?; + } + if let Some(value) = &self.limit_response { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limitResponse", value)?; + } + if let Some(value) = &self.nominal_concurrency_shares { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nominalConcurrencyShares", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LimitedPriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.LimitedPriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "borrowingLimitPercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`borrowingLimitPercent`, if present, configures a limit on how many seats this priority level can borrow from other priority levels. The limit is known as this level's BorrowingConcurrencyLimit (BorrowingCL) and is a limit on the total number of seats that this level may borrow at any one time. This field holds the ratio of that limit to the level's nominal concurrency limit. When this field is non-nil, it must hold a non-negative integer and the limit is calculated as follows.\n\nBorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 )\n\nThe value of this field can be more than 100, implying that this priority level can borrow a number of seats that is greater than its own nominal concurrency limit (NominalCL). When this field is left `nil`, the limit is effectively infinite.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "lendablePercent".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lendablePercent` prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. The value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.\n\nLendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "limitResponse".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`limitResponse` indicates what to do with requests that can not be executed right now".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nominalConcurrencyShares".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of 30.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/mod.rs b/src/v1_30/api/flowcontrol/v1beta3/mod.rs new file mode 100644 index 000000000..94b4bafaf --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/mod.rs @@ -0,0 +1,63 @@ + +mod exempt_priority_level_configuration; +pub use self::exempt_priority_level_configuration::ExemptPriorityLevelConfiguration; + +mod flow_distinguisher_method; +pub use self::flow_distinguisher_method::FlowDistinguisherMethod; + +mod flow_schema; +pub use self::flow_schema::FlowSchema; + +mod flow_schema_condition; +pub use self::flow_schema_condition::FlowSchemaCondition; + +mod flow_schema_spec; +pub use self::flow_schema_spec::FlowSchemaSpec; + +mod flow_schema_status; +pub use self::flow_schema_status::FlowSchemaStatus; + +mod group_subject; +pub use self::group_subject::GroupSubject; + +mod limit_response; +pub use self::limit_response::LimitResponse; + +mod limited_priority_level_configuration; +pub use self::limited_priority_level_configuration::LimitedPriorityLevelConfiguration; + +mod non_resource_policy_rule; +pub use self::non_resource_policy_rule::NonResourcePolicyRule; + +mod policy_rules_with_subjects; +pub use self::policy_rules_with_subjects::PolicyRulesWithSubjects; + +mod priority_level_configuration; +pub use self::priority_level_configuration::PriorityLevelConfiguration; + +mod priority_level_configuration_condition; +pub use self::priority_level_configuration_condition::PriorityLevelConfigurationCondition; + +mod priority_level_configuration_reference; +pub use self::priority_level_configuration_reference::PriorityLevelConfigurationReference; + +mod priority_level_configuration_spec; +pub use self::priority_level_configuration_spec::PriorityLevelConfigurationSpec; + +mod priority_level_configuration_status; +pub use self::priority_level_configuration_status::PriorityLevelConfigurationStatus; + +mod queuing_configuration; +pub use self::queuing_configuration::QueuingConfiguration; + +mod resource_policy_rule; +pub use self::resource_policy_rule::ResourcePolicyRule; + +mod service_account_subject; +pub use self::service_account_subject::ServiceAccountSubject; + +mod subject; +pub use self::subject::Subject; + +mod user_subject; +pub use self::user_subject::UserSubject; diff --git a/src/v1_30/api/flowcontrol/v1beta3/non_resource_policy_rule.rs b/src/v1_30/api/flowcontrol/v1beta3/non_resource_policy_rule.rs new file mode 100644 index 000000000..11fff891c --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/non_resource_policy_rule.rs @@ -0,0 +1,175 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.NonResourcePolicyRule + +/// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NonResourcePolicyRule { + /// `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. For example: + /// - "/healthz" is legal + /// - "/hea*" is illegal + /// - "/hea" is legal but matches nothing + /// - "/hea/*" also matches nothing + /// - "/healthz/*" matches all per-component health checks. + /// "*" matches all non-resource urls. if it is present, it must be the only entry. Required. + pub non_resource_urls: Vec, + + /// `verbs` is a list of matching verbs and may not be empty. "*" matches all verbs. If it is present, it must be the only entry. Required. + pub verbs: Vec, +} + +impl crate::DeepMerge for NonResourcePolicyRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.non_resource_urls, other.non_resource_urls); + crate::merge_strategies::list::set(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NonResourcePolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_urls, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceURLs" => Field::Key_non_resource_urls, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NonResourcePolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NonResourcePolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_urls: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_urls => value_non_resource_urls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NonResourcePolicyRule { + non_resource_urls: value_non_resource_urls.unwrap_or_default(), + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NonResourcePolicyRule", + &[ + "nonResourceURLs", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NonResourcePolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NonResourcePolicyRule", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceURLs", &self.non_resource_urls)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NonResourcePolicyRule { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.NonResourcePolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceURLs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. For example:\n - \"/healthz\" is legal\n - \"/hea*\" is illegal\n - \"/hea\" is legal but matches nothing\n - \"/hea/*\" also matches nothing\n - \"/healthz/*\" matches all per-component health checks.\n\"*\" matches all non-resource urls. if it is present, it must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs. If it is present, it must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "nonResourceURLs".to_owned(), + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/policy_rules_with_subjects.rs b/src/v1_30/api/flowcontrol/v1beta3/policy_rules_with_subjects.rs new file mode 100644 index 000000000..ead5d05c8 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/policy_rules_with_subjects.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PolicyRulesWithSubjects + +/// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PolicyRulesWithSubjects { + /// `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL. + pub non_resource_rules: Option>, + + /// `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. At least one of `resourceRules` and `nonResourceRules` has to be non-empty. + pub resource_rules: Option>, + + /// subjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required. + pub subjects: Vec, +} + +impl crate::DeepMerge for PolicyRulesWithSubjects { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.non_resource_rules, other.non_resource_rules); + crate::merge_strategies::list::atomic(&mut self.resource_rules, other.resource_rules); + crate::merge_strategies::list::atomic(&mut self.subjects, other.subjects); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PolicyRulesWithSubjects { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_non_resource_rules, + Key_resource_rules, + Key_subjects, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nonResourceRules" => Field::Key_non_resource_rules, + "resourceRules" => Field::Key_resource_rules, + "subjects" => Field::Key_subjects, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PolicyRulesWithSubjects; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PolicyRulesWithSubjects") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_non_resource_rules: Option> = None; + let mut value_resource_rules: Option> = None; + let mut value_subjects: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_non_resource_rules => value_non_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_rules => value_resource_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subjects => value_subjects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PolicyRulesWithSubjects { + non_resource_rules: value_non_resource_rules, + resource_rules: value_resource_rules, + subjects: value_subjects.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PolicyRulesWithSubjects", + &[ + "nonResourceRules", + "resourceRules", + "subjects", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PolicyRulesWithSubjects { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PolicyRulesWithSubjects", + 1 + + self.non_resource_rules.as_ref().map_or(0, |_| 1) + + self.resource_rules.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.non_resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceRules", value)?; + } + if let Some(value) = &self.resource_rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceRules", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subjects", &self.subjects)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PolicyRulesWithSubjects { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PolicyRulesWithSubjects".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nonResourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceRules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. At least one of `resourceRules` and `nonResourceRules` has to be non-empty.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "subjects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("subjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "subjects".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration.rs b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration.rs new file mode 100644 index 000000000..4a7825621 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfiguration + +/// PriorityLevelConfiguration represents the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfiguration { + /// `metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// `spec` is the specification of the desired behavior of a "request-priority". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// `status` is the current status of a "request-priority". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for PriorityLevelConfiguration { + const API_VERSION: &'static str = "flowcontrol.apiserver.k8s.io/v1beta3"; + const GROUP: &'static str = "flowcontrol.apiserver.k8s.io"; + const KIND: &'static str = "PriorityLevelConfiguration"; + const VERSION: &'static str = "v1beta3"; + const URL_PATH_SEGMENT: &'static str = "prioritylevelconfigurations"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for PriorityLevelConfiguration { + const LIST_KIND: &'static str = "PriorityLevelConfigurationList"; +} + +impl crate::Metadata for PriorityLevelConfiguration { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PriorityLevelConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfiguration { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfiguration represents the configuration of a priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`spec` is the specification of the desired behavior of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the current status of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_condition.rs b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_condition.rs new file mode 100644 index 000000000..f32ab1e9e --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_condition.rs @@ -0,0 +1,227 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationCondition + +/// PriorityLevelConfigurationCondition defines the condition of priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationCondition { + /// `lastTransitionTime` is the last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// `message` is a human-readable message indicating details about last transition. + pub message: Option, + + /// `reason` is a unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// `status` is the status of the condition. Can be True, False, Unknown. Required. + pub status: Option, + + /// `type` is the type of the condition. Required. + pub type_: Option, +} + +impl crate::DeepMerge for PriorityLevelConfigurationCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status, + type_: value_type_, + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationCondition", + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationCondition { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationCondition defines the condition of priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`lastTransitionTime` is the last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`message` is a human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`reason` is a unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`status` is the status of the condition. Can be True, False, Unknown. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` is the type of the condition. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_reference.rs b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_reference.rs new file mode 100644 index 000000000..5e370132e --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_reference.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationReference + +/// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationReference { + /// `name` is the name of the priority level configuration being referenced Required. + pub name: String, +} + +impl crate::DeepMerge for PriorityLevelConfigurationReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationReference { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationReference", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationReference", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationReference { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationReference contains information that points to the \"request-priority\" being used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of the priority level configuration being referenced Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_spec.rs b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_spec.rs new file mode 100644 index 000000000..35342169f --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_spec.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationSpec + +/// PriorityLevelConfigurationSpec specifies the configuration of a priority level. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationSpec { + /// `exempt` specifies how requests are handled for an exempt priority level. This field MUST be empty if `type` is `"Limited"`. This field MAY be non-empty if `type` is `"Exempt"`. If empty and `type` is `"Exempt"` then the default values for `ExemptPriorityLevelConfiguration` apply. + pub exempt: Option, + + /// `limited` specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if `type` is `"Limited"`. + pub limited: Option, + + /// `type` indicates whether this priority level is subject to limitation on request execution. A value of `"Exempt"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `"Limited"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required. + pub type_: String, +} + +impl crate::DeepMerge for PriorityLevelConfigurationSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.exempt, other.exempt); + crate::DeepMerge::merge_from(&mut self.limited, other.limited); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_exempt, + Key_limited, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "exempt" => Field::Key_exempt, + "limited" => Field::Key_limited, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_exempt: Option = None; + let mut value_limited: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_exempt => value_exempt = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_limited => value_limited = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationSpec { + exempt: value_exempt, + limited: value_limited, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationSpec", + &[ + "exempt", + "limited", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationSpec", + 1 + + self.exempt.as_ref().map_or(0, |_| 1) + + self.limited.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.exempt { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exempt", value)?; + } + if let Some(value) = &self.limited { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "limited", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationSpec { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationSpec specifies the configuration of a priority level.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "exempt".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`exempt` specifies how requests are handled for an exempt priority level. This field MUST be empty if `type` is `\"Limited\"`. This field MAY be non-empty if `type` is `\"Exempt\"`. If empty and `type` is `\"Exempt\"` then the default values for `ExemptPriorityLevelConfiguration` apply.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "limited".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`limited` specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if `type` is `\"Limited\"`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`type` indicates whether this priority level is subject to limitation on request execution. A value of `\"Exempt\"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `\"Limited\"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_status.rs b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_status.rs new file mode 100644 index 000000000..ca66232ba --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/priority_level_configuration_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationStatus + +/// PriorityLevelConfigurationStatus represents the current state of a "request-priority". +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityLevelConfigurationStatus { + /// `conditions` is the current state of "request-priority". + pub conditions: Option>, +} + +impl crate::DeepMerge for PriorityLevelConfigurationStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityLevelConfigurationStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityLevelConfigurationStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PriorityLevelConfigurationStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityLevelConfigurationStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "PriorityLevelConfigurationStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityLevelConfigurationStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PriorityLevelConfigurationStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityLevelConfigurationStatus { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.PriorityLevelConfigurationStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityLevelConfigurationStatus represents the current state of a \"request-priority\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`conditions` is the current state of \"request-priority\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/queuing_configuration.rs b/src/v1_30/api/flowcontrol/v1beta3/queuing_configuration.rs new file mode 100644 index 000000000..d84c2b517 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/queuing_configuration.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.QueuingConfiguration + +/// QueuingConfiguration holds the configuration parameters for queuing +#[derive(Clone, Debug, Default, PartialEq)] +pub struct QueuingConfiguration { + /// `handSize` is a small positive number that configures the shuffle sharding of requests into queues. When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8. + pub hand_size: Option, + + /// `queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50. + pub queue_length_limit: Option, + + /// `queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64. + pub queues: Option, +} + +impl crate::DeepMerge for QueuingConfiguration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.hand_size, other.hand_size); + crate::DeepMerge::merge_from(&mut self.queue_length_limit, other.queue_length_limit); + crate::DeepMerge::merge_from(&mut self.queues, other.queues); + } +} + +impl<'de> crate::serde::Deserialize<'de> for QueuingConfiguration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hand_size, + Key_queue_length_limit, + Key_queues, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "handSize" => Field::Key_hand_size, + "queueLengthLimit" => Field::Key_queue_length_limit, + "queues" => Field::Key_queues, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = QueuingConfiguration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("QueuingConfiguration") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hand_size: Option = None; + let mut value_queue_length_limit: Option = None; + let mut value_queues: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hand_size => value_hand_size = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_queue_length_limit => value_queue_length_limit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_queues => value_queues = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(QueuingConfiguration { + hand_size: value_hand_size, + queue_length_limit: value_queue_length_limit, + queues: value_queues, + }) + } + } + + deserializer.deserialize_struct( + "QueuingConfiguration", + &[ + "handSize", + "queueLengthLimit", + "queues", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for QueuingConfiguration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "QueuingConfiguration", + self.hand_size.as_ref().map_or(0, |_| 1) + + self.queue_length_limit.as_ref().map_or(0, |_| 1) + + self.queues.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hand_size { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "handSize", value)?; + } + if let Some(value) = &self.queue_length_limit { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queueLengthLimit", value)?; + } + if let Some(value) = &self.queues { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "queues", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for QueuingConfiguration { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.QueuingConfiguration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("QueuingConfiguration holds the configuration parameters for queuing".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "handSize".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`handSize` is a small positive number that configures the shuffle sharding of requests into queues. When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "queueLengthLimit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "queues".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/resource_policy_rule.rs b/src/v1_30/api/flowcontrol/v1beta3/resource_policy_rule.rs new file mode 100644 index 000000000..31f0ec8bc --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/resource_policy_rule.rs @@ -0,0 +1,260 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.ResourcePolicyRule + +/// ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==""`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourcePolicyRule { + /// `apiGroups` is a list of matching API groups and may not be empty. "*" matches all API groups and, if present, must be the only entry. Required. + pub api_groups: Vec, + + /// `clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). If this field is omitted or false then the `namespaces` field must contain a non-empty list. + pub cluster_scope: Option, + + /// `namespaces` is a list of target namespaces that restricts matches. A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains "*". Note that "*" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true. + pub namespaces: Option>, + + /// `resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, \[ "services", "nodes/status" \]. This list may not be empty. "*" matches all resources and, if present, must be the only entry. Required. + pub resources: Vec, + + /// `verbs` is a list of matching verbs and may not be empty. "*" matches all verbs and, if present, must be the only entry. Required. + pub verbs: Vec, +} + +impl crate::DeepMerge for ResourcePolicyRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::set(&mut self.api_groups, other.api_groups); + crate::DeepMerge::merge_from(&mut self.cluster_scope, other.cluster_scope); + crate::merge_strategies::list::set(&mut self.namespaces, other.namespaces); + crate::merge_strategies::list::set(&mut self.resources, other.resources); + crate::merge_strategies::list::set(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourcePolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_cluster_scope, + Key_namespaces, + Key_resources, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "clusterScope" => Field::Key_cluster_scope, + "namespaces" => Field::Key_namespaces, + "resources" => Field::Key_resources, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourcePolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourcePolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_cluster_scope: Option = None; + let mut value_namespaces: Option> = None; + let mut value_resources: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_cluster_scope => value_cluster_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespaces => value_namespaces = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourcePolicyRule { + api_groups: value_api_groups.unwrap_or_default(), + cluster_scope: value_cluster_scope, + namespaces: value_namespaces, + resources: value_resources.unwrap_or_default(), + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourcePolicyRule", + &[ + "apiGroups", + "clusterScope", + "namespaces", + "resources", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourcePolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourcePolicyRule", + 3 + + self.cluster_scope.as_ref().map_or(0, |_| 1) + + self.namespaces.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", &self.api_groups)?; + if let Some(value) = &self.cluster_scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterScope", value)?; + } + if let Some(value) = &self.namespaces { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaces", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", &self.resources)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourcePolicyRule { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.ResourcePolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) either (d1) the request does not specify a namespace (i.e., `Namespace==\"\"`) and clusterScope is true or (d2) the request specifies a namespace and least one member of namespaces matches the request's namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`apiGroups` is a list of matching API groups and may not be empty. \"*\" matches all API groups and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "clusterScope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). If this field is omitted or false then the `namespaces` field must contain a non-empty list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "namespaces".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`namespaces` is a list of target namespaces that restricts matches. A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains \"*\". Note that \"*\" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, [ \"services\", \"nodes/status\" ]. This list may not be empty. \"*\" matches all resources and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs and, if present, must be the only entry. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "apiGroups".to_owned(), + "resources".to_owned(), + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/service_account_subject.rs b/src/v1_30/api/flowcontrol/v1beta3/service_account_subject.rs new file mode 100644 index 000000000..501b169c1 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/service_account_subject.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.ServiceAccountSubject + +/// ServiceAccountSubject holds detailed information for service-account-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceAccountSubject { + /// `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name. Required. + pub name: String, + + /// `namespace` is the namespace of matching ServiceAccount objects. Required. + pub namespace: String, +} + +impl crate::DeepMerge for ServiceAccountSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceAccountSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceAccountSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceAccountSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceAccountSubject { + name: value_name.unwrap_or_default(), + namespace: value_namespace.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ServiceAccountSubject", + &[ + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceAccountSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceAccountSubject", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", &self.namespace)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceAccountSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.ServiceAccountSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceAccountSubject holds detailed information for service-account-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the name of matching ServiceAccount objects, or \"*\" to match regardless of name. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`namespace` is the namespace of matching ServiceAccount objects. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "namespace".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/subject.rs b/src/v1_30/api/flowcontrol/v1beta3/subject.rs new file mode 100644 index 000000000..82b9f3c05 --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/subject.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.Subject + +/// Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Subject { + /// `group` matches based on user group name. + pub group: Option, + + /// `kind` indicates which one of the other fields is non-empty. Required + pub kind: String, + + /// `serviceAccount` matches ServiceAccounts. + pub service_account: Option, + + /// `user` matches based on username. + pub user: Option, +} + +impl crate::DeepMerge for Subject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.service_account, other.service_account); + crate::DeepMerge::merge_from(&mut self.user, other.user); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Subject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_kind, + Key_service_account, + Key_user, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "kind" => Field::Key_kind, + "serviceAccount" => Field::Key_service_account, + "user" => Field::Key_user, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Subject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Subject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_kind: Option = None; + let mut value_service_account: Option = None; + let mut value_user: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service_account => value_service_account = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_user => value_user = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Subject { + group: value_group, + kind: value_kind.unwrap_or_default(), + service_account: value_service_account, + user: value_user, + }) + } + } + + deserializer.deserialize_struct( + "Subject", + &[ + "group", + "kind", + "serviceAccount", + "user", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Subject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Subject", + 1 + + self.group.as_ref().map_or(0, |_| 1) + + self.service_account.as_ref().map_or(0, |_| 1) + + self.user.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + if let Some(value) = &self.service_account { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccount", value)?; + } + if let Some(value) = &self.user { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "user", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Subject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.Subject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`group` matches based on user group name.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`kind` indicates which one of the other fields is non-empty. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "serviceAccount".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`serviceAccount` matches ServiceAccounts.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "user".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`user` matches based on username.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "kind".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/flowcontrol/v1beta3/user_subject.rs b/src/v1_30/api/flowcontrol/v1beta3/user_subject.rs new file mode 100644 index 000000000..1a5b9d9db --- /dev/null +++ b/src/v1_30/api/flowcontrol/v1beta3/user_subject.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.flowcontrol.v1beta3.UserSubject + +/// UserSubject holds detailed information for user-kind subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct UserSubject { + /// `name` is the username that matches, or "*" to match all usernames. Required. + pub name: String, +} + +impl crate::DeepMerge for UserSubject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for UserSubject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = UserSubject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("UserSubject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(UserSubject { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "UserSubject", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for UserSubject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "UserSubject", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for UserSubject { + fn schema_name() -> String { + "io.k8s.api.flowcontrol.v1beta3.UserSubject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UserSubject holds detailed information for user-kind subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("`name` is the username that matches, or \"*\" to match all usernames. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/mod.rs b/src/v1_30/api/mod.rs new file mode 100644 index 000000000..60ba243ee --- /dev/null +++ b/src/v1_30/api/mod.rs @@ -0,0 +1,41 @@ +pub mod admissionregistration; + +pub mod apiserverinternal; + +pub mod apps; + +pub mod authentication; + +pub mod authorization; + +pub mod autoscaling; + +pub mod batch; + +pub mod certificates; + +pub mod coordination; + +pub mod core; + +pub mod discovery; + +pub mod events; + +pub mod flowcontrol; + +pub mod networking; + +pub mod node; + +pub mod policy; + +pub mod rbac; + +pub mod resource; + +pub mod scheduling; + +pub mod storage; + +pub mod storagemigration; diff --git a/src/v1_30/api/networking/mod.rs b/src/v1_30/api/networking/mod.rs new file mode 100644 index 000000000..eddcfcf9e --- /dev/null +++ b/src/v1_30/api/networking/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1alpha1; diff --git a/src/v1_30/api/networking/v1/http_ingress_path.rs b/src/v1_30/api/networking/v1/http_ingress_path.rs new file mode 100644 index 000000000..b46ba0d1f --- /dev/null +++ b/src/v1_30/api/networking/v1/http_ingress_path.rs @@ -0,0 +1,186 @@ +// Generated from definition io.k8s.api.networking.v1.HTTPIngressPath + +/// HTTPIngressPath associates a path with a backend. Incoming urls matching the path are forwarded to the backend. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HTTPIngressPath { + /// backend defines the referenced service endpoint to which the traffic will be forwarded to. + pub backend: crate::api::networking::v1::IngressBackend, + + /// path is matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional "path" part of a URL as defined by RFC 3986. Paths must begin with a '/' and must be present when using PathType with value "Exact" or "Prefix". + pub path: Option, + + /// pathType determines the interpretation of the path matching. PathType can be one of the following values: * Exact: Matches the URL path exactly. * Prefix: Matches based on a URL path prefix split by '/'. Matching is + /// done on a path element by element basis. A path element refers is the + /// list of labels in the path split by the '/' separator. A request is a + /// match for path p if every p is an element-wise prefix of p of the + /// request path. Note that if the last element of the path is a substring + /// of the last element in request path, it is not a match (e.g. /foo/bar + /// matches /foo/bar/baz, but does not match /foo/barbaz). + /// * ImplementationSpecific: Interpretation of the Path matching is up to + /// the IngressClass. Implementations can treat this as a separate PathType + /// or treat it identically to Prefix or Exact path types. + /// Implementations are required to support all path types. + pub path_type: String, +} + +impl crate::DeepMerge for HTTPIngressPath { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.backend, other.backend); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.path_type, other.path_type); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HTTPIngressPath { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_backend, + Key_path, + Key_path_type, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "backend" => Field::Key_backend, + "path" => Field::Key_path, + "pathType" => Field::Key_path_type, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HTTPIngressPath; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HTTPIngressPath") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_backend: Option = None; + let mut value_path: Option = None; + let mut value_path_type: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_backend => value_backend = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path_type => value_path_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HTTPIngressPath { + backend: value_backend.unwrap_or_default(), + path: value_path, + path_type: value_path_type.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HTTPIngressPath", + &[ + "backend", + "path", + "pathType", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HTTPIngressPath { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HTTPIngressPath", + 2 + + self.path.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "backend", &self.backend)?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pathType", &self.path_type)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HTTPIngressPath { + fn schema_name() -> String { + "io.k8s.api.networking.v1.HTTPIngressPath".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPIngressPath associates a path with a backend. Incoming urls matching the path are forwarded to the backend.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "backend".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("backend defines the referenced service endpoint to which the traffic will be forwarded to.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional \"path\" part of a URL as defined by RFC 3986. Paths must begin with a '/' and must be present when using PathType with value \"Exact\" or \"Prefix\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "pathType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("pathType determines the interpretation of the path matching. PathType can be one of the following values: * Exact: Matches the URL path exactly. * Prefix: Matches based on a URL path prefix split by '/'. Matching is\n done on a path element by element basis. A path element refers is the\n list of labels in the path split by the '/' separator. A request is a\n match for path p if every p is an element-wise prefix of p of the\n request path. Note that if the last element of the path is a substring\n of the last element in request path, it is not a match (e.g. /foo/bar\n matches /foo/bar/baz, but does not match /foo/barbaz).\n* ImplementationSpecific: Interpretation of the Path matching is up to\n the IngressClass. Implementations can treat this as a separate PathType\n or treat it identically to Prefix or Exact path types.\nImplementations are required to support all path types.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "backend".to_owned(), + "pathType".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/http_ingress_rule_value.rs b/src/v1_30/api/networking/v1/http_ingress_rule_value.rs new file mode 100644 index 000000000..75eaccc53 --- /dev/null +++ b/src/v1_30/api/networking/v1/http_ingress_rule_value.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.networking.v1.HTTPIngressRuleValue + +/// HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http://\/\?\ -\> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct HTTPIngressRuleValue { + /// paths is a collection of paths that map requests to backends. + pub paths: Vec, +} + +impl crate::DeepMerge for HTTPIngressRuleValue { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.paths, other.paths); + } +} + +impl<'de> crate::serde::Deserialize<'de> for HTTPIngressRuleValue { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_paths, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "paths" => Field::Key_paths, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = HTTPIngressRuleValue; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("HTTPIngressRuleValue") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_paths: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_paths => value_paths = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(HTTPIngressRuleValue { + paths: value_paths.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "HTTPIngressRuleValue", + &[ + "paths", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for HTTPIngressRuleValue { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "HTTPIngressRuleValue", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "paths", &self.paths)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for HTTPIngressRuleValue { + fn schema_name() -> String { + "io.k8s.api.networking.v1.HTTPIngressRuleValue".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http:///? -> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "paths".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("paths is a collection of paths that map requests to backends.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "paths".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress.rs b/src/v1_30/api/networking/v1/ingress.rs new file mode 100644 index 000000000..d72d528e5 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.networking.v1.Ingress + +/// Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Ingress { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Ingress { + const API_VERSION: &'static str = "networking.k8s.io/v1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "Ingress"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "ingresses"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Ingress { + const LIST_KIND: &'static str = "IngressList"; +} + +impl crate::Metadata for Ingress { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Ingress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Ingress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Ingress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Ingress { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Ingress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Ingress { + fn schema_name() -> String { + "io.k8s.api.networking.v1.Ingress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_backend.rs b/src/v1_30/api/networking/v1/ingress_backend.rs new file mode 100644 index 000000000..650819d40 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_backend.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.networking.v1.IngressBackend + +/// IngressBackend describes all endpoints for a given service and port. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressBackend { + /// resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. If resource is specified, a service.Name and service.Port must not be specified. This is a mutually exclusive setting with "Service". + pub resource: Option, + + /// service references a service as a backend. This is a mutually exclusive setting with "Resource". + pub service: Option, +} + +impl crate::DeepMerge for IngressBackend { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.service, other.service); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressBackend { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_resource, + Key_service, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "resource" => Field::Key_resource, + "service" => Field::Key_service, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressBackend; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressBackend") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_resource: Option = None; + let mut value_service: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressBackend { + resource: value_resource, + service: value_service, + }) + } + } + + deserializer.deserialize_struct( + "IngressBackend", + &[ + "resource", + "service", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressBackend { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressBackend", + self.resource.as_ref().map_or(0, |_| 1) + + self.service.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", value)?; + } + if let Some(value) = &self.service { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressBackend { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressBackend".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressBackend describes all endpoints for a given service and port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "resource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. If resource is specified, a service.Name and service.Port must not be specified. This is a mutually exclusive setting with \"Service\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "service".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("service references a service as a backend. This is a mutually exclusive setting with \"Resource\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_class.rs b/src/v1_30/api/networking/v1/ingress_class.rs new file mode 100644 index 000000000..bf1ae1e4d --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_class.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.networking.v1.IngressClass + +/// IngressClass represents the class of the Ingress, referenced by the Ingress Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressClass { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::Resource for IngressClass { + const API_VERSION: &'static str = "networking.k8s.io/v1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "IngressClass"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "ingressclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for IngressClass { + const LIST_KIND: &'static str = "IngressClassList"; +} + +impl crate::Metadata for IngressClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for IngressClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressClass { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressClass { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressClass represents the class of the Ingress, referenced by the Ingress Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_class_parameters_reference.rs b/src/v1_30/api/networking/v1/ingress_class_parameters_reference.rs new file mode 100644 index 000000000..ab7b7a1b1 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_class_parameters_reference.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.networking.v1.IngressClassParametersReference + +/// IngressClassParametersReference identifies an API object. This can be used to specify a cluster or namespace-scoped resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressClassParametersReference { + /// apiGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + pub api_group: Option, + + /// kind is the type of resource being referenced. + pub kind: String, + + /// name is the name of resource being referenced. + pub name: String, + + /// namespace is the namespace of the resource being referenced. This field is required when scope is set to "Namespace" and must be unset when scope is set to "Cluster". + pub namespace: Option, + + /// scope represents if this refers to a cluster or namespace scoped resource. This may be set to "Cluster" (default) or "Namespace". + pub scope: Option, +} + +impl crate::DeepMerge for IngressClassParametersReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressClassParametersReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Key_namespace, + Key_scope, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "scope" => Field::Key_scope, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressClassParametersReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressClassParametersReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_scope: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressClassParametersReference { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespace: value_namespace, + scope: value_scope, + }) + } + } + + deserializer.deserialize_struct( + "IngressClassParametersReference", + &[ + "apiGroup", + "kind", + "name", + "namespace", + "scope", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressClassParametersReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressClassParametersReference", + 2 + + self.api_group.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.scope.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.scope { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressClassParametersReference { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressClassParametersReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressClassParametersReference identifies an API object. This can be used to specify a cluster or namespace-scoped resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("apiGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind is the type of resource being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of resource being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace is the namespace of the resource being referenced. This field is required when scope is set to \"Namespace\" and must be unset when scope is set to \"Cluster\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope represents if this refers to a cluster or namespace scoped resource. This may be set to \"Cluster\" (default) or \"Namespace\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_class_spec.rs b/src/v1_30/api/networking/v1/ingress_class_spec.rs new file mode 100644 index 000000000..ba5da7b6f --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_class_spec.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.networking.v1.IngressClassSpec + +/// IngressClassSpec provides information about the class of an Ingress. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressClassSpec { + /// controller refers to the name of the controller that should handle this class. This allows for different "flavors" that are controlled by the same controller. For example, you may have different parameters for the same implementing controller. This should be specified as a domain-prefixed path no more than 250 characters in length, e.g. "acme.io/ingress-controller". This field is immutable. + pub controller: Option, + + /// parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters. + pub parameters: Option, +} + +impl crate::DeepMerge for IngressClassSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.controller, other.controller); + crate::DeepMerge::merge_from(&mut self.parameters, other.parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressClassSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_controller, + Key_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "controller" => Field::Key_controller, + "parameters" => Field::Key_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressClassSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressClassSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_controller: Option = None; + let mut value_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_controller => value_controller = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters => value_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressClassSpec { + controller: value_controller, + parameters: value_parameters, + }) + } + } + + deserializer.deserialize_struct( + "IngressClassSpec", + &[ + "controller", + "parameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressClassSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressClassSpec", + self.controller.as_ref().map_or(0, |_| 1) + + self.parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.controller { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "controller", value)?; + } + if let Some(value) = &self.parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressClassSpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressClassSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressClassSpec provides information about the class of an Ingress.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "controller".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("controller refers to the name of the controller that should handle this class. This allows for different \"flavors\" that are controlled by the same controller. For example, you may have different parameters for the same implementing controller. This should be specified as a domain-prefixed path no more than 250 characters in length, e.g. \"acme.io/ingress-controller\". This field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_load_balancer_ingress.rs b/src/v1_30/api/networking/v1/ingress_load_balancer_ingress.rs new file mode 100644 index 000000000..776bbdc62 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_load_balancer_ingress.rs @@ -0,0 +1,181 @@ +// Generated from definition io.k8s.api.networking.v1.IngressLoadBalancerIngress + +/// IngressLoadBalancerIngress represents the status of a load-balancer ingress point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressLoadBalancerIngress { + /// hostname is set for load-balancer ingress points that are DNS based. + pub hostname: Option, + + /// ip is set for load-balancer ingress points that are IP based. + pub ip: Option, + + /// ports provides information about the ports exposed by this LoadBalancer. + pub ports: Option>, +} + +impl crate::DeepMerge for IngressLoadBalancerIngress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.hostname, other.hostname); + crate::DeepMerge::merge_from(&mut self.ip, other.ip); + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressLoadBalancerIngress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hostname, + Key_ip, + Key_ports, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hostname" => Field::Key_hostname, + "ip" => Field::Key_ip, + "ports" => Field::Key_ports, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressLoadBalancerIngress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressLoadBalancerIngress") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hostname: Option = None; + let mut value_ip: Option = None; + let mut value_ports: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hostname => value_hostname = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ip => value_ip = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressLoadBalancerIngress { + hostname: value_hostname, + ip: value_ip, + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + "IngressLoadBalancerIngress", + &[ + "hostname", + "ip", + "ports", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressLoadBalancerIngress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressLoadBalancerIngress", + self.hostname.as_ref().map_or(0, |_| 1) + + self.ip.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hostname { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostname", value)?; + } + if let Some(value) = &self.ip { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ip", value)?; + } + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressLoadBalancerIngress { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressLoadBalancerIngress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressLoadBalancerIngress represents the status of a load-balancer ingress point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hostname".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hostname is set for load-balancer ingress points that are DNS based.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ip".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ip is set for load-balancer ingress points that are IP based.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ports provides information about the ports exposed by this LoadBalancer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_load_balancer_status.rs b/src/v1_30/api/networking/v1/ingress_load_balancer_status.rs new file mode 100644 index 000000000..c4bfb8373 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_load_balancer_status.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.networking.v1.IngressLoadBalancerStatus + +/// IngressLoadBalancerStatus represents the status of a load-balancer. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressLoadBalancerStatus { + /// ingress is a list containing ingress points for the load-balancer. + pub ingress: Option>, +} + +impl crate::DeepMerge for IngressLoadBalancerStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.ingress, other.ingress); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressLoadBalancerStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ingress, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ingress" => Field::Key_ingress, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressLoadBalancerStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressLoadBalancerStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ingress: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ingress => value_ingress = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressLoadBalancerStatus { + ingress: value_ingress, + }) + } + } + + deserializer.deserialize_struct( + "IngressLoadBalancerStatus", + &[ + "ingress", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressLoadBalancerStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressLoadBalancerStatus", + self.ingress.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ingress { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ingress", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressLoadBalancerStatus { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressLoadBalancerStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressLoadBalancerStatus represents the status of a load-balancer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ingress".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ingress is a list containing ingress points for the load-balancer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_port_status.rs b/src/v1_30/api/networking/v1/ingress_port_status.rs new file mode 100644 index 000000000..a97ef5b08 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_port_status.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.networking.v1.IngressPortStatus + +/// IngressPortStatus represents the error condition of a service port +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressPortStatus { + /// error is to record the problem with the service port The format of the error shall comply with the following rules: - built-in error values shall be specified in this file and those shall use + /// CamelCase names + /// - cloud provider specific error values must have names that comply with the + /// format foo.example.com/CamelCase. + pub error: Option, + + /// port is the port number of the ingress port. + pub port: i32, + + /// protocol is the protocol of the ingress port. The supported values are: "TCP", "UDP", "SCTP" + pub protocol: String, +} + +impl crate::DeepMerge for IngressPortStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.error, other.error); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressPortStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_error, + Key_port, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "error" => Field::Key_error, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressPortStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressPortStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_error: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_error => value_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressPortStatus { + error: value_error, + port: value_port.unwrap_or_default(), + protocol: value_protocol.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "IngressPortStatus", + &[ + "error", + "port", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressPortStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressPortStatus", + 2 + + self.error.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "error", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", &self.port)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", &self.protocol)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressPortStatus { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressPortStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressPortStatus represents the error condition of a service port".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "error".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("error is to record the problem with the service port The format of the error shall comply with the following rules: - built-in error values shall be specified in this file and those shall use\n CamelCase names\n- cloud provider specific error values must have names that comply with the\n format foo.example.com/CamelCase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("port is the port number of the ingress port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("protocol is the protocol of the ingress port. The supported values are: \"TCP\", \"UDP\", \"SCTP\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "port".to_owned(), + "protocol".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_rule.rs b/src/v1_30/api/networking/v1/ingress_rule.rs new file mode 100644 index 000000000..4f8904e92 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_rule.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.api.networking.v1.IngressRule + +/// IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressRule { + /// host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to + /// the IP in the Spec of the parent Ingress. + /// 2. The `:` delimiter is not respected because ports are not allowed. + /// Currently the port of an Ingress is implicitly :80 for http and + /// :443 for https. + /// Both these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue. + /// + /// host can be "precise" which is a domain name without the terminating dot of a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name prefixed with a single wildcard label (e.g. "*.foo.com"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*"). Requests will be matched against the Host field in the following way: 1. If host is precise, the request matches this rule if the http host header is equal to Host. 2. If host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule. + pub host: Option, + + pub http: Option, +} + +impl crate::DeepMerge for IngressRule { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.host, other.host); + crate::DeepMerge::merge_from(&mut self.http, other.http); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_host, + Key_http, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "host" => Field::Key_host, + "http" => Field::Key_http, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_host: Option = None; + let mut value_http: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_host => value_host = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_http => value_http = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressRule { + host: value_host, + http: value_http, + }) + } + } + + deserializer.deserialize_struct( + "IngressRule", + &[ + "host", + "http", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressRule", + self.host.as_ref().map_or(0, |_| 1) + + self.http.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.host { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "host", value)?; + } + if let Some(value) = &self.http { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "http", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressRule { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "host".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to\n the IP in the Spec of the parent Ingress.\n2. The `:` delimiter is not respected because ports are not allowed.\n\t Currently the port of an Ingress is implicitly :80 for http and\n\t :443 for https.\nBoth these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.\n\nhost can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.bar.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \"*.foo.com\"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == \"*\"). Requests will be matched against the Host field in the following way: 1. If host is precise, the request matches this rule if the http host header is equal to Host. 2. If host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "http".to_owned(), + __gen.subschema_for::(), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_service_backend.rs b/src/v1_30/api/networking/v1/ingress_service_backend.rs new file mode 100644 index 000000000..249c1dec2 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_service_backend.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.networking.v1.IngressServiceBackend + +/// IngressServiceBackend references a Kubernetes Service as a Backend. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressServiceBackend { + /// name is the referenced service. The service must exist in the same namespace as the Ingress object. + pub name: String, + + /// port of the referenced service. A port name or port number is required for a IngressServiceBackend. + pub port: Option, +} + +impl crate::DeepMerge for IngressServiceBackend { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressServiceBackend { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressServiceBackend; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressServiceBackend") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressServiceBackend { + name: value_name.unwrap_or_default(), + port: value_port, + }) + } + } + + deserializer.deserialize_struct( + "IngressServiceBackend", + &[ + "name", + "port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressServiceBackend { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressServiceBackend", + 1 + + self.port.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressServiceBackend { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressServiceBackend".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressServiceBackend references a Kubernetes Service as a Backend.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the referenced service. The service must exist in the same namespace as the Ingress object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("port of the referenced service. A port name or port number is required for a IngressServiceBackend.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_spec.rs b/src/v1_30/api/networking/v1/ingress_spec.rs new file mode 100644 index 000000000..9c0de691e --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_spec.rs @@ -0,0 +1,210 @@ +// Generated from definition io.k8s.api.networking.v1.IngressSpec + +/// IngressSpec describes the Ingress the user wishes to exist. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressSpec { + /// defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller. + pub default_backend: Option, + + /// ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -\> IngressClass -\> Ingress resource). Although the `kubernetes.io/ingress.class` annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present. + pub ingress_class_name: Option, + + /// rules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend. + pub rules: Option>, + + /// tls represents the TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI. + pub tls: Option>, +} + +impl crate::DeepMerge for IngressSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.default_backend, other.default_backend); + crate::DeepMerge::merge_from(&mut self.ingress_class_name, other.ingress_class_name); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + crate::merge_strategies::list::atomic(&mut self.tls, other.tls); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_default_backend, + Key_ingress_class_name, + Key_rules, + Key_tls, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "defaultBackend" => Field::Key_default_backend, + "ingressClassName" => Field::Key_ingress_class_name, + "rules" => Field::Key_rules, + "tls" => Field::Key_tls, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_default_backend: Option = None; + let mut value_ingress_class_name: Option = None; + let mut value_rules: Option> = None; + let mut value_tls: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_default_backend => value_default_backend = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ingress_class_name => value_ingress_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tls => value_tls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressSpec { + default_backend: value_default_backend, + ingress_class_name: value_ingress_class_name, + rules: value_rules, + tls: value_tls, + }) + } + } + + deserializer.deserialize_struct( + "IngressSpec", + &[ + "defaultBackend", + "ingressClassName", + "rules", + "tls", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressSpec", + self.default_backend.as_ref().map_or(0, |_| 1) + + self.ingress_class_name.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1) + + self.tls.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.default_backend { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "defaultBackend", value)?; + } + if let Some(value) = &self.ingress_class_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ingressClassName", value)?; + } + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + if let Some(value) = &self.tls { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tls", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressSpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressSpec describes the Ingress the user wishes to exist.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "defaultBackend".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "ingressClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the `kubernetes.io/ingress.class` annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("rules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "tls".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("tls represents the TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_status.rs b/src/v1_30/api/networking/v1/ingress_status.rs new file mode 100644 index 000000000..27ddbc97e --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_status.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.api.networking.v1.IngressStatus + +/// IngressStatus describe the current state of the Ingress. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressStatus { + /// loadBalancer contains the current status of the load-balancer. + pub load_balancer: Option, +} + +impl crate::DeepMerge for IngressStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.load_balancer, other.load_balancer); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_load_balancer, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "loadBalancer" => Field::Key_load_balancer, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_load_balancer: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_load_balancer => value_load_balancer = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressStatus { + load_balancer: value_load_balancer, + }) + } + } + + deserializer.deserialize_struct( + "IngressStatus", + &[ + "loadBalancer", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressStatus", + self.load_balancer.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.load_balancer { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "loadBalancer", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressStatus { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressStatus describe the current state of the Ingress.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "loadBalancer".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("loadBalancer contains the current status of the load-balancer.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ingress_tls.rs b/src/v1_30/api/networking/v1/ingress_tls.rs new file mode 100644 index 000000000..3ee0dfa97 --- /dev/null +++ b/src/v1_30/api/networking/v1/ingress_tls.rs @@ -0,0 +1,161 @@ +// Generated from definition io.k8s.api.networking.v1.IngressTLS + +/// IngressTLS describes the transport layer security associated with an ingress. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IngressTLS { + /// hosts is a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified. + pub hosts: Option>, + + /// secretName is the name of the secret used to terminate TLS traffic on port 443. Field is left optional to allow TLS routing based on SNI hostname alone. If the SNI host in a listener conflicts with the "Host" header field used by an IngressRule, the SNI host is used for termination and value of the "Host" header is used for routing. + pub secret_name: Option, +} + +impl crate::DeepMerge for IngressTLS { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.hosts, other.hosts); + crate::DeepMerge::merge_from(&mut self.secret_name, other.secret_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IngressTLS { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_hosts, + Key_secret_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "hosts" => Field::Key_hosts, + "secretName" => Field::Key_secret_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IngressTLS; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IngressTLS") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_hosts: Option> = None; + let mut value_secret_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_hosts => value_hosts = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_secret_name => value_secret_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IngressTLS { + hosts: value_hosts, + secret_name: value_secret_name, + }) + } + } + + deserializer.deserialize_struct( + "IngressTLS", + &[ + "hosts", + "secretName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IngressTLS { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IngressTLS", + self.hosts.as_ref().map_or(0, |_| 1) + + self.secret_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.hosts { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hosts", value)?; + } + if let Some(value) = &self.secret_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secretName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IngressTLS { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IngressTLS".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IngressTLS describes the transport layer security associated with an ingress.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "hosts".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("hosts is a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "secretName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("secretName is the name of the secret used to terminate TLS traffic on port 443. Field is left optional to allow TLS routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the \"Host\" header is used for routing.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/ip_block.rs b/src/v1_30/api/networking/v1/ip_block.rs new file mode 100644 index 000000000..abaf49170 --- /dev/null +++ b/src/v1_30/api/networking/v1/ip_block.rs @@ -0,0 +1,162 @@ +// Generated from definition io.k8s.api.networking.v1.IPBlock + +/// IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IPBlock { + /// cidr is a string representing the IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64" + pub cidr: String, + + /// except is a slice of CIDRs that should not be included within an IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64" Except values will be rejected if they are outside the cidr range + pub except: Option>, +} + +impl crate::DeepMerge for IPBlock { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.cidr, other.cidr); + crate::merge_strategies::list::atomic(&mut self.except, other.except); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IPBlock { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_cidr, + Key_except, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "cidr" => Field::Key_cidr, + "except" => Field::Key_except, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IPBlock; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IPBlock") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_cidr: Option = None; + let mut value_except: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_cidr => value_cidr = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_except => value_except = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IPBlock { + cidr: value_cidr.unwrap_or_default(), + except: value_except, + }) + } + } + + deserializer.deserialize_struct( + "IPBlock", + &[ + "cidr", + "except", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IPBlock { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IPBlock", + 1 + + self.except.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cidr", &self.cidr)?; + if let Some(value) = &self.except { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "except", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IPBlock { + fn schema_name() -> String { + "io.k8s.api.networking.v1.IPBlock".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPBlock describes a particular CIDR (Ex. \"192.168.1.0/24\",\"2001:db8::/64\") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "cidr".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("cidr is a string representing the IPBlock Valid examples are \"192.168.1.0/24\" or \"2001:db8::/64\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "except".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("except is a slice of CIDRs that should not be included within an IPBlock Valid examples are \"192.168.1.0/24\" or \"2001:db8::/64\" Except values will be rejected if they are outside the cidr range".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "cidr".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/mod.rs b/src/v1_30/api/networking/v1/mod.rs new file mode 100644 index 000000000..b1d96bb80 --- /dev/null +++ b/src/v1_30/api/networking/v1/mod.rs @@ -0,0 +1,69 @@ + +mod http_ingress_path; +pub use self::http_ingress_path::HTTPIngressPath; + +mod http_ingress_rule_value; +pub use self::http_ingress_rule_value::HTTPIngressRuleValue; + +mod ip_block; +pub use self::ip_block::IPBlock; + +mod ingress; +pub use self::ingress::Ingress; + +mod ingress_backend; +pub use self::ingress_backend::IngressBackend; + +mod ingress_class; +pub use self::ingress_class::IngressClass; + +mod ingress_class_parameters_reference; +pub use self::ingress_class_parameters_reference::IngressClassParametersReference; + +mod ingress_class_spec; +pub use self::ingress_class_spec::IngressClassSpec; + +mod ingress_load_balancer_ingress; +pub use self::ingress_load_balancer_ingress::IngressLoadBalancerIngress; + +mod ingress_load_balancer_status; +pub use self::ingress_load_balancer_status::IngressLoadBalancerStatus; + +mod ingress_port_status; +pub use self::ingress_port_status::IngressPortStatus; + +mod ingress_rule; +pub use self::ingress_rule::IngressRule; + +mod ingress_service_backend; +pub use self::ingress_service_backend::IngressServiceBackend; + +mod ingress_spec; +pub use self::ingress_spec::IngressSpec; + +mod ingress_status; +pub use self::ingress_status::IngressStatus; + +mod ingress_tls; +pub use self::ingress_tls::IngressTLS; + +mod network_policy; +pub use self::network_policy::NetworkPolicy; + +mod network_policy_egress_rule; +pub use self::network_policy_egress_rule::NetworkPolicyEgressRule; + +mod network_policy_ingress_rule; +pub use self::network_policy_ingress_rule::NetworkPolicyIngressRule; + +mod network_policy_peer; +pub use self::network_policy_peer::NetworkPolicyPeer; + +mod network_policy_port; +pub use self::network_policy_port::NetworkPolicyPort; + +mod network_policy_spec; +pub use self::network_policy_spec::NetworkPolicySpec; + +mod service_backend_port; +pub use self::service_backend_port::ServiceBackendPort; diff --git a/src/v1_30/api/networking/v1/network_policy.rs b/src/v1_30/api/networking/v1/network_policy.rs new file mode 100644 index 000000000..6b4d2f430 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicy + +/// NetworkPolicy describes what network traffic is allowed for a set of Pods +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicy { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec represents the specification of the desired behavior for this NetworkPolicy. + pub spec: Option, +} + +impl crate::Resource for NetworkPolicy { + const API_VERSION: &'static str = "networking.k8s.io/v1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "NetworkPolicy"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "networkpolicies"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for NetworkPolicy { + const LIST_KIND: &'static str = "NetworkPolicyList"; +} + +impl crate::Metadata for NetworkPolicy { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for NetworkPolicy { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicy { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicy; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicy { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicy { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicy { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicy".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicy describes what network traffic is allowed for a set of Pods".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec represents the specification of the desired behavior for this NetworkPolicy.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/network_policy_egress_rule.rs b/src/v1_30/api/networking/v1/network_policy_egress_rule.rs new file mode 100644 index 000000000..78f61e005 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy_egress_rule.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicyEgressRule + +/// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. This type is beta-level in 1.8 +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicyEgressRule { + /// ports is a list of destination ports for outgoing traffic. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list. + pub ports: Option>, + + /// to is a list of destinations for outgoing traffic of pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all destinations (traffic not restricted by destination). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the to list. + pub to: Option>, +} + +impl crate::DeepMerge for NetworkPolicyEgressRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + crate::merge_strategies::list::atomic(&mut self.to, other.to); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicyEgressRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ports, + Key_to, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ports" => Field::Key_ports, + "to" => Field::Key_to, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicyEgressRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicyEgressRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ports: Option> = None; + let mut value_to: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_to => value_to = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicyEgressRule { + ports: value_ports, + to: value_to, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicyEgressRule", + &[ + "ports", + "to", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicyEgressRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicyEgressRule", + self.ports.as_ref().map_or(0, |_| 1) + + self.to.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + if let Some(value) = &self.to { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "to", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicyEgressRule { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicyEgressRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. This type is beta-level in 1.8".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ports is a list of destination ports for outgoing traffic. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "to".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("to is a list of destinations for outgoing traffic of pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all destinations (traffic not restricted by destination). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the to list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/network_policy_ingress_rule.rs b/src/v1_30/api/networking/v1/network_policy_ingress_rule.rs new file mode 100644 index 000000000..f9f0e9d04 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy_ingress_rule.rs @@ -0,0 +1,160 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicyIngressRule + +/// NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicyIngressRule { + /// from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list. + pub from: Option>, + + /// ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list. + pub ports: Option>, +} + +impl crate::DeepMerge for NetworkPolicyIngressRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.from, other.from); + crate::merge_strategies::list::atomic(&mut self.ports, other.ports); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicyIngressRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_from, + Key_ports, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "from" => Field::Key_from, + "ports" => Field::Key_ports, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicyIngressRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicyIngressRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_from: Option> = None; + let mut value_ports: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_from => value_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ports => value_ports = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicyIngressRule { + from: value_from, + ports: value_ports, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicyIngressRule", + &[ + "from", + "ports", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicyIngressRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicyIngressRule", + self.from.as_ref().map_or(0, |_| 1) + + self.ports.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "from", value)?; + } + if let Some(value) = &self.ports { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ports", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicyIngressRule { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicyIngressRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "from".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ports".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/network_policy_peer.rs b/src/v1_30/api/networking/v1/network_policy_peer.rs new file mode 100644 index 000000000..2ce8b74e2 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy_peer.rs @@ -0,0 +1,181 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicyPeer + +/// NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of fields are allowed +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicyPeer { + /// ipBlock defines policy on a particular IPBlock. If this field is set then neither of the other fields can be. + pub ip_block: Option, + + /// namespaceSelector selects namespaces using cluster-scoped labels. This field follows standard label selector semantics; if present but empty, it selects all namespaces. + /// + /// If podSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the namespaces selected by namespaceSelector. Otherwise it selects all pods in the namespaces selected by namespaceSelector. + pub namespace_selector: Option, + + /// podSelector is a label selector which selects pods. This field follows standard label selector semantics; if present but empty, it selects all pods. + /// + /// If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects the pods matching podSelector in the policy's own namespace. + pub pod_selector: Option, +} + +impl crate::DeepMerge for NetworkPolicyPeer { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ip_block, other.ip_block); + crate::DeepMerge::merge_from(&mut self.namespace_selector, other.namespace_selector); + crate::DeepMerge::merge_from(&mut self.pod_selector, other.pod_selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicyPeer { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ip_block, + Key_namespace_selector, + Key_pod_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ipBlock" => Field::Key_ip_block, + "namespaceSelector" => Field::Key_namespace_selector, + "podSelector" => Field::Key_pod_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicyPeer; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicyPeer") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ip_block: Option = None; + let mut value_namespace_selector: Option = None; + let mut value_pod_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ip_block => value_ip_block = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace_selector => value_namespace_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_selector => value_pod_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicyPeer { + ip_block: value_ip_block, + namespace_selector: value_namespace_selector, + pod_selector: value_pod_selector, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicyPeer", + &[ + "ipBlock", + "namespaceSelector", + "podSelector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicyPeer { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicyPeer", + self.ip_block.as_ref().map_or(0, |_| 1) + + self.namespace_selector.as_ref().map_or(0, |_| 1) + + self.pod_selector.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ip_block { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ipBlock", value)?; + } + if let Some(value) = &self.namespace_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaceSelector", value)?; + } + if let Some(value) = &self.pod_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podSelector", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicyPeer { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicyPeer".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of fields are allowed".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ipBlock".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ipBlock defines policy on a particular IPBlock. If this field is set then neither of the other fields can be.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "namespaceSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespaceSelector selects namespaces using cluster-scoped labels. This field follows standard label selector semantics; if present but empty, it selects all namespaces.\n\nIf podSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the namespaces selected by namespaceSelector. Otherwise it selects all pods in the namespaces selected by namespaceSelector.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "podSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podSelector is a label selector which selects pods. This field follows standard label selector semantics; if present but empty, it selects all pods.\n\nIf namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects the pods matching podSelector in the policy's own namespace.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/network_policy_port.rs b/src/v1_30/api/networking/v1/network_policy_port.rs new file mode 100644 index 000000000..2466eab61 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy_port.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicyPort + +/// NetworkPolicyPort describes a port to allow traffic on +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicyPort { + /// endPort indicates that the range of ports from port to endPort if set, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port. + pub end_port: Option, + + /// port represents the port on the given protocol. This can either be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers. If present, only traffic on the specified protocol AND port will be matched. + pub port: Option, + + /// protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. + pub protocol: Option, +} + +impl crate::DeepMerge for NetworkPolicyPort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.end_port, other.end_port); + crate::DeepMerge::merge_from(&mut self.port, other.port); + crate::DeepMerge::merge_from(&mut self.protocol, other.protocol); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicyPort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_end_port, + Key_port, + Key_protocol, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "endPort" => Field::Key_end_port, + "port" => Field::Key_port, + "protocol" => Field::Key_protocol, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicyPort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicyPort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_end_port: Option = None; + let mut value_port: Option = None; + let mut value_protocol: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_end_port => value_end_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_protocol => value_protocol = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicyPort { + end_port: value_end_port, + port: value_port, + protocol: value_protocol, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicyPort", + &[ + "endPort", + "port", + "protocol", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicyPort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicyPort", + self.end_port.as_ref().map_or(0, |_| 1) + + self.port.as_ref().map_or(0, |_| 1) + + self.protocol.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.end_port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "endPort", value)?; + } + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + if let Some(value) = &self.protocol { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "protocol", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicyPort { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicyPort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicyPort describes a port to allow traffic on".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "endPort".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("endPort indicates that the range of ports from port to endPort if set, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "port".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("port represents the port on the given protocol. This can either be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers. If present, only traffic on the specified protocol AND port will be matched.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "protocol".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/network_policy_spec.rs b/src/v1_30/api/networking/v1/network_policy_spec.rs new file mode 100644 index 000000000..2ad57e1e0 --- /dev/null +++ b/src/v1_30/api/networking/v1/network_policy_spec.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.networking.v1.NetworkPolicySpec + +/// NetworkPolicySpec provides the specification of a NetworkPolicy +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NetworkPolicySpec { + /// egress is a list of egress rules to be applied to the selected pods. Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8 + pub egress: Option>, + + /// ingress is a list of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default) + pub ingress: Option>, + + /// podSelector selects the pods to which this NetworkPolicy object applies. The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace. + pub pod_selector: crate::apimachinery::pkg::apis::meta::v1::LabelSelector, + + /// policyTypes is a list of rule types that the NetworkPolicy relates to. Valid options are \["Ingress"\], \["Egress"\], or \["Ingress", "Egress"\]. If this field is not specified, it will default based on the existence of ingress or egress rules; policies that contain an egress section are assumed to affect egress, and all policies (whether or not they contain an ingress section) are assumed to affect ingress. If you want to write an egress-only policy, you must explicitly specify policyTypes \[ "Egress" \]. Likewise, if you want to write a policy that specifies that no egress is allowed, you must specify a policyTypes value that include "Egress" (since such a policy would not include an egress section and would otherwise default to just \[ "Ingress" \]). This field is beta-level in 1.8 + pub policy_types: Option>, +} + +impl crate::DeepMerge for NetworkPolicySpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.egress, other.egress); + crate::merge_strategies::list::atomic(&mut self.ingress, other.ingress); + crate::DeepMerge::merge_from(&mut self.pod_selector, other.pod_selector); + crate::merge_strategies::list::atomic(&mut self.policy_types, other.policy_types); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NetworkPolicySpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_egress, + Key_ingress, + Key_pod_selector, + Key_policy_types, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "egress" => Field::Key_egress, + "ingress" => Field::Key_ingress, + "podSelector" => Field::Key_pod_selector, + "policyTypes" => Field::Key_policy_types, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NetworkPolicySpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NetworkPolicySpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_egress: Option> = None; + let mut value_ingress: Option> = None; + let mut value_pod_selector: Option = None; + let mut value_policy_types: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_egress => value_egress = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_ingress => value_ingress = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_selector => value_pod_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_policy_types => value_policy_types = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NetworkPolicySpec { + egress: value_egress, + ingress: value_ingress, + pod_selector: value_pod_selector.unwrap_or_default(), + policy_types: value_policy_types, + }) + } + } + + deserializer.deserialize_struct( + "NetworkPolicySpec", + &[ + "egress", + "ingress", + "podSelector", + "policyTypes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NetworkPolicySpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NetworkPolicySpec", + 1 + + self.egress.as_ref().map_or(0, |_| 1) + + self.ingress.as_ref().map_or(0, |_| 1) + + self.policy_types.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.egress { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "egress", value)?; + } + if let Some(value) = &self.ingress { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ingress", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podSelector", &self.pod_selector)?; + if let Some(value) = &self.policy_types { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "policyTypes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NetworkPolicySpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1.NetworkPolicySpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NetworkPolicySpec provides the specification of a NetworkPolicy".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "egress".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("egress is a list of egress rules to be applied to the selected pods. Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "ingress".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ingress is a list of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "podSelector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podSelector selects the pods to which this NetworkPolicy object applies. The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "policyTypes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("policyTypes is a list of rule types that the NetworkPolicy relates to. Valid options are [\"Ingress\"], [\"Egress\"], or [\"Ingress\", \"Egress\"]. If this field is not specified, it will default based on the existence of ingress or egress rules; policies that contain an egress section are assumed to affect egress, and all policies (whether or not they contain an ingress section) are assumed to affect ingress. If you want to write an egress-only policy, you must explicitly specify policyTypes [ \"Egress\" ]. Likewise, if you want to write a policy that specifies that no egress is allowed, you must specify a policyTypes value that include \"Egress\" (since such a policy would not include an egress section and would otherwise default to just [ \"Ingress\" ]). This field is beta-level in 1.8".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "podSelector".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1/service_backend_port.rs b/src/v1_30/api/networking/v1/service_backend_port.rs new file mode 100644 index 000000000..16d2b1521 --- /dev/null +++ b/src/v1_30/api/networking/v1/service_backend_port.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.networking.v1.ServiceBackendPort + +/// ServiceBackendPort is the service port being referenced. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceBackendPort { + /// name is the name of the port on the Service. This is a mutually exclusive setting with "Number". + pub name: Option, + + /// number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with "Name". + pub number: Option, +} + +impl crate::DeepMerge for ServiceBackendPort { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.number, other.number); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceBackendPort { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_number, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "number" => Field::Key_number, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceBackendPort; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceBackendPort") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_number: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_number => value_number = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceBackendPort { + name: value_name, + number: value_number, + }) + } + } + + deserializer.deserialize_struct( + "ServiceBackendPort", + &[ + "name", + "number", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceBackendPort { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceBackendPort", + self.name.as_ref().map_or(0, |_| 1) + + self.number.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.number { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "number", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceBackendPort { + fn schema_name() -> String { + "io.k8s.api.networking.v1.ServiceBackendPort".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceBackendPort is the service port being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the port on the Service. This is a mutually exclusive setting with \"Number\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "number".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with \"Name\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/ip_address.rs b/src/v1_30/api/networking/v1alpha1/ip_address.rs new file mode 100644 index 000000000..c157716ea --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/ip_address.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.IPAddress + +/// IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1 +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IPAddress { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, +} + +impl crate::Resource for IPAddress { + const API_VERSION: &'static str = "networking.k8s.io/v1alpha1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "IPAddress"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "ipaddresses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for IPAddress { + const LIST_KIND: &'static str = "IPAddressList"; +} + +impl crate::Metadata for IPAddress { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for IPAddress { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IPAddress { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IPAddress; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IPAddress { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IPAddress { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IPAddress { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.IPAddress".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/ip_address_spec.rs b/src/v1_30/api/networking/v1alpha1/ip_address_spec.rs new file mode 100644 index 000000000..6acf6dec4 --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/ip_address_spec.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.IPAddressSpec + +/// IPAddressSpec describe the attributes in an IP Address. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct IPAddressSpec { + /// ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object. + pub parent_ref: crate::api::networking::v1alpha1::ParentReference, +} + +impl crate::DeepMerge for IPAddressSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.parent_ref, other.parent_ref); + } +} + +impl<'de> crate::serde::Deserialize<'de> for IPAddressSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_parent_ref, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "parentRef" => Field::Key_parent_ref, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IPAddressSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("IPAddressSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_parent_ref: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_parent_ref => value_parent_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(IPAddressSpec { + parent_ref: value_parent_ref.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "IPAddressSpec", + &[ + "parentRef", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for IPAddressSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "IPAddressSpec", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parentRef", &self.parent_ref)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IPAddressSpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.IPAddressSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IPAddressSpec describe the attributes in an IP Address.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "parentRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "parentRef".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/mod.rs b/src/v1_30/api/networking/v1alpha1/mod.rs new file mode 100644 index 000000000..ead99cf6c --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/mod.rs @@ -0,0 +1,18 @@ + +mod ip_address; +pub use self::ip_address::IPAddress; + +mod ip_address_spec; +pub use self::ip_address_spec::IPAddressSpec; + +mod parent_reference; +pub use self::parent_reference::ParentReference; + +mod service_cidr; +pub use self::service_cidr::ServiceCIDR; + +mod service_cidr_spec; +pub use self::service_cidr_spec::ServiceCIDRSpec; + +mod service_cidr_status; +pub use self::service_cidr_status::ServiceCIDRStatus; diff --git a/src/v1_30/api/networking/v1alpha1/parent_reference.rs b/src/v1_30/api/networking/v1alpha1/parent_reference.rs new file mode 100644 index 000000000..332348c93 --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/parent_reference.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ParentReference + +/// ParentReference describes a reference to a parent object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ParentReference { + /// Group is the group of the object being referenced. + pub group: Option, + + /// Name is the name of the object being referenced. + pub name: String, + + /// Namespace is the namespace of the object being referenced. + pub namespace: Option, + + /// Resource is the resource of the object being referenced. + pub resource: String, +} + +impl crate::DeepMerge for ParentReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ParentReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_name, + Key_namespace, + Key_resource, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "resource" => Field::Key_resource, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ParentReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ParentReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_resource: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ParentReference { + group: value_group, + name: value_name.unwrap_or_default(), + namespace: value_namespace, + resource: value_resource.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ParentReference", + &[ + "group", + "name", + "namespace", + "resource", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ParentReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ParentReference", + 2 + + self.group.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", &self.resource)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ParentReference { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ParentReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParentReference describes a reference to a parent object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Group is the group of the object being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the object being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace is the namespace of the object being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resource is the resource of the object being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "resource".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/service_cidr.rs b/src/v1_30/api/networking/v1alpha1/service_cidr.rs new file mode 100644 index 000000000..20b4e6468 --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/service_cidr.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ServiceCIDR + +/// ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceCIDR { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub spec: Option, + + /// status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for ServiceCIDR { + const API_VERSION: &'static str = "networking.k8s.io/v1alpha1"; + const GROUP: &'static str = "networking.k8s.io"; + const KIND: &'static str = "ServiceCIDR"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "servicecidrs"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ServiceCIDR { + const LIST_KIND: &'static str = "ServiceCIDRList"; +} + +impl crate::Metadata for ServiceCIDR { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ServiceCIDR { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceCIDR { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceCIDR; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceCIDR { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceCIDR { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceCIDR { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ServiceCIDR".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/service_cidr_spec.rs b/src/v1_30/api/networking/v1alpha1/service_cidr_spec.rs new file mode 100644 index 000000000..325036c84 --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/service_cidr_spec.rs @@ -0,0 +1,136 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ServiceCIDRSpec + +/// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceCIDRSpec { + /// CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable. + pub cidrs: Option>, +} + +impl crate::DeepMerge for ServiceCIDRSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.cidrs, other.cidrs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceCIDRSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_cidrs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "cidrs" => Field::Key_cidrs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceCIDRSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceCIDRSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_cidrs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_cidrs => value_cidrs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceCIDRSpec { + cidrs: value_cidrs, + }) + } + } + + deserializer.deserialize_struct( + "ServiceCIDRSpec", + &[ + "cidrs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceCIDRSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceCIDRSpec", + self.cidrs.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.cidrs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cidrs", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceCIDRSpec { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ServiceCIDRSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "cidrs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/networking/v1alpha1/service_cidr_status.rs b/src/v1_30/api/networking/v1alpha1/service_cidr_status.rs new file mode 100644 index 000000000..2a59cf738 --- /dev/null +++ b/src/v1_30/api/networking/v1alpha1/service_cidr_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.networking.v1alpha1.ServiceCIDRStatus + +/// ServiceCIDRStatus describes the current state of the ServiceCIDR. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceCIDRStatus { + /// conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state + pub conditions: Option>, +} + +impl crate::DeepMerge for ServiceCIDRStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceCIDRStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceCIDRStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceCIDRStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceCIDRStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "ServiceCIDRStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceCIDRStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceCIDRStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceCIDRStatus { + fn schema_name() -> String { + "io.k8s.api.networking.v1alpha1.ServiceCIDRStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceCIDRStatus describes the current state of the ServiceCIDR.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/node/mod.rs b/src/v1_30/api/node/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/node/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/node/v1/mod.rs b/src/v1_30/api/node/v1/mod.rs new file mode 100644 index 000000000..08a4d1cb9 --- /dev/null +++ b/src/v1_30/api/node/v1/mod.rs @@ -0,0 +1,9 @@ + +mod overhead; +pub use self::overhead::Overhead; + +mod runtime_class; +pub use self::runtime_class::RuntimeClass; + +mod scheduling; +pub use self::scheduling::Scheduling; diff --git a/src/v1_30/api/node/v1/overhead.rs b/src/v1_30/api/node/v1/overhead.rs new file mode 100644 index 000000000..e8b47b970 --- /dev/null +++ b/src/v1_30/api/node/v1/overhead.rs @@ -0,0 +1,133 @@ +// Generated from definition io.k8s.api.node.v1.Overhead + +/// Overhead structure represents the resource overhead associated with running a pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Overhead { + /// podFixed represents the fixed resource overhead associated with running a pod. + pub pod_fixed: Option>, +} + +impl crate::DeepMerge for Overhead { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.pod_fixed, other.pod_fixed, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Overhead { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_pod_fixed, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "podFixed" => Field::Key_pod_fixed, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Overhead; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Overhead") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_pod_fixed: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_pod_fixed => value_pod_fixed = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Overhead { + pod_fixed: value_pod_fixed, + }) + } + } + + deserializer.deserialize_struct( + "Overhead", + &[ + "podFixed", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Overhead { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Overhead", + self.pod_fixed.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.pod_fixed { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podFixed", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Overhead { + fn schema_name() -> String { + "io.k8s.api.node.v1.Overhead".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Overhead structure represents the resource overhead associated with running a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "podFixed".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podFixed represents the fixed resource overhead associated with running a pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/node/v1/runtime_class.rs b/src/v1_30/api/node/v1/runtime_class.rs new file mode 100644 index 000000000..fc3830dac --- /dev/null +++ b/src/v1_30/api/node/v1/runtime_class.rs @@ -0,0 +1,269 @@ +// Generated from definition io.k8s.api.node.v1.RuntimeClass + +/// RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/ +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RuntimeClass { + /// handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called "runc" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable. + pub handler: String, + + /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see + /// https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/ + pub overhead: Option, + + /// scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes. + pub scheduling: Option, +} + +impl crate::Resource for RuntimeClass { + const API_VERSION: &'static str = "node.k8s.io/v1"; + const GROUP: &'static str = "node.k8s.io"; + const KIND: &'static str = "RuntimeClass"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "runtimeclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for RuntimeClass { + const LIST_KIND: &'static str = "RuntimeClassList"; +} + +impl crate::Metadata for RuntimeClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for RuntimeClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.handler, other.handler); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.overhead, other.overhead); + crate::DeepMerge::merge_from(&mut self.scheduling, other.scheduling); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RuntimeClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_handler, + Key_metadata, + Key_overhead, + Key_scheduling, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "handler" => Field::Key_handler, + "metadata" => Field::Key_metadata, + "overhead" => Field::Key_overhead, + "scheduling" => Field::Key_scheduling, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RuntimeClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_handler: Option = None; + let mut value_metadata: Option = None; + let mut value_overhead: Option = None; + let mut value_scheduling: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_handler => value_handler = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_overhead => value_overhead = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scheduling => value_scheduling = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RuntimeClass { + handler: value_handler.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + overhead: value_overhead, + scheduling: value_scheduling, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "handler", + "metadata", + "overhead", + "scheduling", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RuntimeClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.overhead.as_ref().map_or(0, |_| 1) + + self.scheduling.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "handler", &self.handler)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.overhead { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "overhead", value)?; + } + if let Some(value) = &self.scheduling { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scheduling", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RuntimeClass { + fn schema_name() -> String { + "io.k8s.api.node.v1.RuntimeClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "handler".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "overhead".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "scheduling".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "handler".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/node/v1/scheduling.rs b/src/v1_30/api/node/v1/scheduling.rs new file mode 100644 index 000000000..79508f62c --- /dev/null +++ b/src/v1_30/api/node/v1/scheduling.rs @@ -0,0 +1,165 @@ +// Generated from definition io.k8s.api.node.v1.Scheduling + +/// Scheduling specifies the scheduling constraints for nodes supporting a RuntimeClass. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Scheduling { + /// nodeSelector lists labels that must be present on nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The RuntimeClass nodeSelector is merged with a pod's existing nodeSelector. Any conflicts will cause the pod to be rejected in admission. + pub node_selector: Option>, + + /// tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass. + pub tolerations: Option>, +} + +impl crate::DeepMerge for Scheduling { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::atomic(&mut self.node_selector, other.node_selector); + crate::merge_strategies::list::atomic(&mut self.tolerations, other.tolerations); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Scheduling { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_node_selector, + Key_tolerations, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nodeSelector" => Field::Key_node_selector, + "tolerations" => Field::Key_tolerations, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Scheduling; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Scheduling") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_node_selector: Option> = None; + let mut value_tolerations: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_node_selector => value_node_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_tolerations => value_tolerations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Scheduling { + node_selector: value_node_selector, + tolerations: value_tolerations, + }) + } + } + + deserializer.deserialize_struct( + "Scheduling", + &[ + "nodeSelector", + "tolerations", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Scheduling { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Scheduling", + self.node_selector.as_ref().map_or(0, |_| 1) + + self.tolerations.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.node_selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeSelector", value)?; + } + if let Some(value) = &self.tolerations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tolerations", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Scheduling { + fn schema_name() -> String { + "io.k8s.api.node.v1.Scheduling".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Scheduling specifies the scheduling constraints for nodes supporting a RuntimeClass.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nodeSelector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeSelector lists labels that must be present on nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The RuntimeClass nodeSelector is merged with a pod's existing nodeSelector. Any conflicts will cause the pod to be rejected in admission.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "tolerations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("tolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/policy/mod.rs b/src/v1_30/api/policy/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/policy/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/policy/v1/eviction.rs b/src/v1_30/api/policy/v1/eviction.rs new file mode 100644 index 000000000..00a4e8a25 --- /dev/null +++ b/src/v1_30/api/policy/v1/eviction.rs @@ -0,0 +1,216 @@ +// Generated from definition io.k8s.api.policy.v1.Eviction + +/// Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods/\/evictions. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Eviction { + /// DeleteOptions may be provided + pub delete_options: Option, + + /// ObjectMeta describes the pod that is being evicted. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, +} + +impl crate::Resource for Eviction { + const API_VERSION: &'static str = "policy/v1"; + const GROUP: &'static str = "policy"; + const KIND: &'static str = "Eviction"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "eviction"; + type Scope = crate::SubResourceScope; +} + +impl crate::Metadata for Eviction { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Eviction { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.delete_options, other.delete_options); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Eviction { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_delete_options, + Key_metadata, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "deleteOptions" => Field::Key_delete_options, + "metadata" => Field::Key_metadata, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Eviction; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_delete_options: Option = None; + let mut value_metadata: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_delete_options => value_delete_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Eviction { + delete_options: value_delete_options, + metadata: value_metadata.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "deleteOptions", + "metadata", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Eviction { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.delete_options.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.delete_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deleteOptions", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Eviction { + fn schema_name() -> String { + "io.k8s.api.policy.v1.Eviction".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "deleteOptions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeleteOptions may be provided".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectMeta describes the pod that is being evicted.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/policy/v1/mod.rs b/src/v1_30/api/policy/v1/mod.rs new file mode 100644 index 000000000..4b9d97c5d --- /dev/null +++ b/src/v1_30/api/policy/v1/mod.rs @@ -0,0 +1,12 @@ + +mod eviction; +pub use self::eviction::Eviction; + +mod pod_disruption_budget; +pub use self::pod_disruption_budget::PodDisruptionBudget; + +mod pod_disruption_budget_spec; +pub use self::pod_disruption_budget_spec::PodDisruptionBudgetSpec; + +mod pod_disruption_budget_status; +pub use self::pod_disruption_budget_status::PodDisruptionBudgetStatus; diff --git a/src/v1_30/api/policy/v1/pod_disruption_budget.rs b/src/v1_30/api/policy/v1/pod_disruption_budget.rs new file mode 100644 index 000000000..eaf5f61e3 --- /dev/null +++ b/src/v1_30/api/policy/v1/pod_disruption_budget.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.policy.v1.PodDisruptionBudget + +/// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodDisruptionBudget { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the desired behavior of the PodDisruptionBudget. + pub spec: Option, + + /// Most recently observed status of the PodDisruptionBudget. + pub status: Option, +} + +impl crate::Resource for PodDisruptionBudget { + const API_VERSION: &'static str = "policy/v1"; + const GROUP: &'static str = "policy"; + const KIND: &'static str = "PodDisruptionBudget"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "poddisruptionbudgets"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for PodDisruptionBudget { + const LIST_KIND: &'static str = "PodDisruptionBudgetList"; +} + +impl crate::Metadata for PodDisruptionBudget { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PodDisruptionBudget { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodDisruptionBudget { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodDisruptionBudget; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodDisruptionBudget { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodDisruptionBudget { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodDisruptionBudget { + fn schema_name() -> String { + "io.k8s.api.policy.v1.PodDisruptionBudget".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the desired behavior of the PodDisruptionBudget.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recently observed status of the PodDisruptionBudget.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/policy/v1/pod_disruption_budget_spec.rs b/src/v1_30/api/policy/v1/pod_disruption_budget_spec.rs new file mode 100644 index 000000000..36a5c60e2 --- /dev/null +++ b/src/v1_30/api/policy/v1/pod_disruption_budget_spec.rs @@ -0,0 +1,212 @@ +// Generated from definition io.k8s.api.policy.v1.PodDisruptionBudgetSpec + +/// PodDisruptionBudgetSpec is a description of a PodDisruptionBudget. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodDisruptionBudgetSpec { + /// An eviction is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with "minAvailable". + pub max_unavailable: Option, + + /// An eviction is allowed if at least "minAvailable" pods selected by "selector" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying "100%". + pub min_available: Option, + + /// Label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace. + pub selector: Option, + + /// UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type="Ready",status="True". + /// + /// Valid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy. + /// + /// IfHealthyBudget policy means that running pods (status.phase="Running"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction. + /// + /// AlwaysAllow policy means that all running pods (status.phase="Running"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction. + /// + /// Additional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field. + /// + /// This field is beta-level. The eviction API uses this field when the feature gate PDBUnhealthyPodEvictionPolicy is enabled (enabled by default). + pub unhealthy_pod_eviction_policy: Option, +} + +impl crate::DeepMerge for PodDisruptionBudgetSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.max_unavailable, other.max_unavailable); + crate::DeepMerge::merge_from(&mut self.min_available, other.min_available); + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + crate::DeepMerge::merge_from(&mut self.unhealthy_pod_eviction_policy, other.unhealthy_pod_eviction_policy); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodDisruptionBudgetSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_max_unavailable, + Key_min_available, + Key_selector, + Key_unhealthy_pod_eviction_policy, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "maxUnavailable" => Field::Key_max_unavailable, + "minAvailable" => Field::Key_min_available, + "selector" => Field::Key_selector, + "unhealthyPodEvictionPolicy" => Field::Key_unhealthy_pod_eviction_policy, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodDisruptionBudgetSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodDisruptionBudgetSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_max_unavailable: Option = None; + let mut value_min_available: Option = None; + let mut value_selector: Option = None; + let mut value_unhealthy_pod_eviction_policy: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_max_unavailable => value_max_unavailable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_available => value_min_available = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_unhealthy_pod_eviction_policy => value_unhealthy_pod_eviction_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodDisruptionBudgetSpec { + max_unavailable: value_max_unavailable, + min_available: value_min_available, + selector: value_selector, + unhealthy_pod_eviction_policy: value_unhealthy_pod_eviction_policy, + }) + } + } + + deserializer.deserialize_struct( + "PodDisruptionBudgetSpec", + &[ + "maxUnavailable", + "minAvailable", + "selector", + "unhealthyPodEvictionPolicy", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodDisruptionBudgetSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodDisruptionBudgetSpec", + self.max_unavailable.as_ref().map_or(0, |_| 1) + + self.min_available.as_ref().map_or(0, |_| 1) + + self.selector.as_ref().map_or(0, |_| 1) + + self.unhealthy_pod_eviction_policy.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.max_unavailable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxUnavailable", value)?; + } + if let Some(value) = &self.min_available { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minAvailable", value)?; + } + if let Some(value) = &self.selector { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", value)?; + } + if let Some(value) = &self.unhealthy_pod_eviction_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "unhealthyPodEvictionPolicy", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodDisruptionBudgetSpec { + fn schema_name() -> String { + "io.k8s.api.policy.v1.PodDisruptionBudgetSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodDisruptionBudgetSpec is a description of a PodDisruptionBudget.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "maxUnavailable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "minAvailable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "selector".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "unhealthyPodEvictionPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".\n\nValid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.\n\nIfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.\n\nAlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.\n\nAdditional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.\n\nThis field is beta-level. The eviction API uses this field when the feature gate PDBUnhealthyPodEvictionPolicy is enabled (enabled by default).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/policy/v1/pod_disruption_budget_status.rs b/src/v1_30/api/policy/v1/pod_disruption_budget_status.rs new file mode 100644 index 000000000..cf8b02d00 --- /dev/null +++ b/src/v1_30/api/policy/v1/pod_disruption_budget_status.rs @@ -0,0 +1,302 @@ +// Generated from definition io.k8s.api.policy.v1.PodDisruptionBudgetStatus + +/// PodDisruptionBudgetStatus represents information about the status of a PodDisruptionBudget. Status may trail the actual state of a system. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodDisruptionBudgetStatus { + /// Conditions contain conditions for PDB. The disruption controller sets the DisruptionAllowed condition. The following are known values for the reason field (additional reasons could be added in the future): - SyncFailed: The controller encountered an error and wasn't able to compute + /// the number of allowed disruptions. Therefore no disruptions are + /// allowed and the status of the condition will be False. + /// - InsufficientPods: The number of pods are either at or below the number + /// required by the PodDisruptionBudget. No disruptions are + /// allowed and the status of the condition will be False. + /// - SufficientPods: There are more pods than required by the PodDisruptionBudget. + /// The condition will be True, and the number of allowed + /// disruptions are provided by the disruptionsAllowed property. + pub conditions: Option>, + + /// current number of healthy pods + pub current_healthy: i32, + + /// minimum desired number of healthy pods + pub desired_healthy: i32, + + /// DisruptedPods contains information about pods whose eviction was processed by the API server eviction subresource handler but has not yet been observed by the PodDisruptionBudget controller. A pod will be in this map from the time when the API server processed the eviction request to the time when the pod is seen by PDB controller as having been marked for deletion (or after a timeout). The key in the map is the name of the pod and the value is the time when the API server processed the eviction request. If the deletion didn't occur and a pod is still there it will be removed from the list automatically by PodDisruptionBudget controller after some time. If everything goes smooth this map should be empty for the most of the time. Large number of entries in the map may indicate problems with pod deletions. + pub disrupted_pods: Option>, + + /// Number of pod disruptions that are currently allowed. + pub disruptions_allowed: i32, + + /// total number of pods counted by this disruption budget + pub expected_pods: i32, + + /// Most recent generation observed when updating this PDB status. DisruptionsAllowed and other status information is valid only if observedGeneration equals to PDB's object generation. + pub observed_generation: Option, +} + +impl crate::DeepMerge for PodDisruptionBudgetStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.current_healthy, other.current_healthy); + crate::DeepMerge::merge_from(&mut self.desired_healthy, other.desired_healthy); + crate::merge_strategies::map::granular(&mut self.disrupted_pods, other.disrupted_pods, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.disruptions_allowed, other.disruptions_allowed); + crate::DeepMerge::merge_from(&mut self.expected_pods, other.expected_pods); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodDisruptionBudgetStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_current_healthy, + Key_desired_healthy, + Key_disrupted_pods, + Key_disruptions_allowed, + Key_expected_pods, + Key_observed_generation, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "currentHealthy" => Field::Key_current_healthy, + "desiredHealthy" => Field::Key_desired_healthy, + "disruptedPods" => Field::Key_disrupted_pods, + "disruptionsAllowed" => Field::Key_disruptions_allowed, + "expectedPods" => Field::Key_expected_pods, + "observedGeneration" => Field::Key_observed_generation, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodDisruptionBudgetStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodDisruptionBudgetStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_current_healthy: Option = None; + let mut value_desired_healthy: Option = None; + let mut value_disrupted_pods: Option> = None; + let mut value_disruptions_allowed: Option = None; + let mut value_expected_pods: Option = None; + let mut value_observed_generation: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_current_healthy => value_current_healthy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_desired_healthy => value_desired_healthy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_disrupted_pods => value_disrupted_pods = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_disruptions_allowed => value_disruptions_allowed = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_expected_pods => value_expected_pods = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodDisruptionBudgetStatus { + conditions: value_conditions, + current_healthy: value_current_healthy.unwrap_or_default(), + desired_healthy: value_desired_healthy.unwrap_or_default(), + disrupted_pods: value_disrupted_pods, + disruptions_allowed: value_disruptions_allowed.unwrap_or_default(), + expected_pods: value_expected_pods.unwrap_or_default(), + observed_generation: value_observed_generation, + }) + } + } + + deserializer.deserialize_struct( + "PodDisruptionBudgetStatus", + &[ + "conditions", + "currentHealthy", + "desiredHealthy", + "disruptedPods", + "disruptionsAllowed", + "expectedPods", + "observedGeneration", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodDisruptionBudgetStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodDisruptionBudgetStatus", + 4 + + self.conditions.as_ref().map_or(0, |_| 1) + + self.disrupted_pods.as_ref().map_or(0, |_| 1) + + self.observed_generation.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "currentHealthy", &self.current_healthy)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "desiredHealthy", &self.desired_healthy)?; + if let Some(value) = &self.disrupted_pods { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "disruptedPods", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "disruptionsAllowed", &self.disruptions_allowed)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expectedPods", &self.expected_pods)?; + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodDisruptionBudgetStatus { + fn schema_name() -> String { + "io.k8s.api.policy.v1.PodDisruptionBudgetStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodDisruptionBudgetStatus represents information about the status of a PodDisruptionBudget. Status may trail the actual state of a system.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Conditions contain conditions for PDB. The disruption controller sets the DisruptionAllowed condition. The following are known values for the reason field (additional reasons could be added in the future): - SyncFailed: The controller encountered an error and wasn't able to compute\n the number of allowed disruptions. Therefore no disruptions are\n allowed and the status of the condition will be False.\n- InsufficientPods: The number of pods are either at or below the number\n required by the PodDisruptionBudget. No disruptions are\n allowed and the status of the condition will be False.\n- SufficientPods: There are more pods than required by the PodDisruptionBudget.\n The condition will be True, and the number of allowed\n disruptions are provided by the disruptionsAllowed property.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "currentHealthy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("current number of healthy pods".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "desiredHealthy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("minimum desired number of healthy pods".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "disruptedPods".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DisruptedPods contains information about pods whose eviction was processed by the API server eviction subresource handler but has not yet been observed by the PodDisruptionBudget controller. A pod will be in this map from the time when the API server processed the eviction request to the time when the pod is seen by PDB controller as having been marked for deletion (or after a timeout). The key in the map is the name of the pod and the value is the time when the API server processed the eviction request. If the deletion didn't occur and a pod is still there it will be removed from the list automatically by PodDisruptionBudget controller after some time. If everything goes smooth this map should be empty for the most of the time. Large number of entries in the map may indicate problems with pod deletions.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "disruptionsAllowed".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of pod disruptions that are currently allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "expectedPods".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("total number of pods counted by this disruption budget".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Most recent generation observed when updating this PDB status. DisruptionsAllowed and other status information is valid only if observedGeneration equals to PDB's object generation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "currentHealthy".to_owned(), + "desiredHealthy".to_owned(), + "disruptionsAllowed".to_owned(), + "expectedPods".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/mod.rs b/src/v1_30/api/rbac/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/rbac/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/rbac/v1/aggregation_rule.rs b/src/v1_30/api/rbac/v1/aggregation_rule.rs new file mode 100644 index 000000000..b20ce6170 --- /dev/null +++ b/src/v1_30/api/rbac/v1/aggregation_rule.rs @@ -0,0 +1,131 @@ +// Generated from definition io.k8s.api.rbac.v1.AggregationRule + +/// AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AggregationRule { + /// ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added + pub cluster_role_selectors: Option>, +} + +impl crate::DeepMerge for AggregationRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.cluster_role_selectors, other.cluster_role_selectors); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AggregationRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_cluster_role_selectors, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "clusterRoleSelectors" => Field::Key_cluster_role_selectors, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AggregationRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AggregationRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_cluster_role_selectors: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_cluster_role_selectors => value_cluster_role_selectors = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AggregationRule { + cluster_role_selectors: value_cluster_role_selectors, + }) + } + } + + deserializer.deserialize_struct( + "AggregationRule", + &[ + "clusterRoleSelectors", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AggregationRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AggregationRule", + self.cluster_role_selectors.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.cluster_role_selectors { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clusterRoleSelectors", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AggregationRule { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.AggregationRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "clusterRoleSelectors".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/cluster_role.rs b/src/v1_30/api/rbac/v1/cluster_role.rs new file mode 100644 index 000000000..7d4e53ed1 --- /dev/null +++ b/src/v1_30/api/rbac/v1/cluster_role.rs @@ -0,0 +1,249 @@ +// Generated from definition io.k8s.api.rbac.v1.ClusterRole + +/// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterRole { + /// AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller. + pub aggregation_rule: Option, + + /// Standard object's metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Rules holds all the PolicyRules for this ClusterRole + pub rules: Option>, +} + +impl crate::Resource for ClusterRole { + const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1"; + const GROUP: &'static str = "rbac.authorization.k8s.io"; + const KIND: &'static str = "ClusterRole"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "clusterroles"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ClusterRole { + const LIST_KIND: &'static str = "ClusterRoleList"; +} + +impl crate::Metadata for ClusterRole { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ClusterRole { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.aggregation_rule, other.aggregation_rule); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterRole { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_aggregation_rule, + Key_metadata, + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "aggregationRule" => Field::Key_aggregation_rule, + "metadata" => Field::Key_metadata, + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterRole; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_aggregation_rule: Option = None; + let mut value_metadata: Option = None; + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_aggregation_rule => value_aggregation_rule = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterRole { + aggregation_rule: value_aggregation_rule, + metadata: value_metadata.unwrap_or_default(), + rules: value_rules, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "aggregationRule", + "metadata", + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterRole { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.aggregation_rule.as_ref().map_or(0, |_| 1) + + self.rules.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.aggregation_rule { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "aggregationRule", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterRole { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.ClusterRole".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "aggregationRule".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rules holds all the PolicyRules for this ClusterRole".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/cluster_role_binding.rs b/src/v1_30/api/rbac/v1/cluster_role_binding.rs new file mode 100644 index 000000000..ef898c27c --- /dev/null +++ b/src/v1_30/api/rbac/v1/cluster_role_binding.rs @@ -0,0 +1,247 @@ +// Generated from definition io.k8s.api.rbac.v1.ClusterRoleBinding + +/// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ClusterRoleBinding { + /// Standard object's metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable. + pub role_ref: crate::api::rbac::v1::RoleRef, + + /// Subjects holds references to the objects the role applies to. + pub subjects: Option>, +} + +impl crate::Resource for ClusterRoleBinding { + const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1"; + const GROUP: &'static str = "rbac.authorization.k8s.io"; + const KIND: &'static str = "ClusterRoleBinding"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "clusterrolebindings"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ClusterRoleBinding { + const LIST_KIND: &'static str = "ClusterRoleBindingList"; +} + +impl crate::Metadata for ClusterRoleBinding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ClusterRoleBinding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.role_ref, other.role_ref); + crate::merge_strategies::list::atomic(&mut self.subjects, other.subjects); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ClusterRoleBinding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_role_ref, + Key_subjects, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "roleRef" => Field::Key_role_ref, + "subjects" => Field::Key_subjects, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ClusterRoleBinding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_role_ref: Option = None; + let mut value_subjects: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_role_ref => value_role_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subjects => value_subjects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ClusterRoleBinding { + metadata: value_metadata.unwrap_or_default(), + role_ref: value_role_ref.unwrap_or_default(), + subjects: value_subjects, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "roleRef", + "subjects", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ClusterRoleBinding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.subjects.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "roleRef", &self.role_ref)?; + if let Some(value) = &self.subjects { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subjects", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ClusterRoleBinding { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.ClusterRoleBinding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "roleRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "subjects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subjects holds references to the objects the role applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "roleRef".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/mod.rs b/src/v1_30/api/rbac/v1/mod.rs new file mode 100644 index 000000000..b714208de --- /dev/null +++ b/src/v1_30/api/rbac/v1/mod.rs @@ -0,0 +1,24 @@ + +mod aggregation_rule; +pub use self::aggregation_rule::AggregationRule; + +mod cluster_role; +pub use self::cluster_role::ClusterRole; + +mod cluster_role_binding; +pub use self::cluster_role_binding::ClusterRoleBinding; + +mod policy_rule; +pub use self::policy_rule::PolicyRule; + +mod role; +pub use self::role::Role; + +mod role_binding; +pub use self::role_binding::RoleBinding; + +mod role_ref; +pub use self::role_ref::RoleRef; + +mod subject; +pub use self::subject::Subject; diff --git a/src/v1_30/api/rbac/v1/policy_rule.rs b/src/v1_30/api/rbac/v1/policy_rule.rs new file mode 100644 index 000000000..3102e5bc6 --- /dev/null +++ b/src/v1_30/api/rbac/v1/policy_rule.rs @@ -0,0 +1,273 @@ +// Generated from definition io.k8s.api.rbac.v1.PolicyRule + +/// PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PolicyRule { + /// APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups. + pub api_groups: Option>, + + /// NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + pub non_resource_urls: Option>, + + /// ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + pub resource_names: Option>, + + /// Resources is a list of resources this rule applies to. '*' represents all resources. + pub resources: Option>, + + /// Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. + pub verbs: Vec, +} + +impl crate::DeepMerge for PolicyRule { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.api_groups, other.api_groups); + crate::merge_strategies::list::atomic(&mut self.non_resource_urls, other.non_resource_urls); + crate::merge_strategies::list::atomic(&mut self.resource_names, other.resource_names); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + crate::merge_strategies::list::atomic(&mut self.verbs, other.verbs); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PolicyRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_groups, + Key_non_resource_urls, + Key_resource_names, + Key_resources, + Key_verbs, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroups" => Field::Key_api_groups, + "nonResourceURLs" => Field::Key_non_resource_urls, + "resourceNames" => Field::Key_resource_names, + "resources" => Field::Key_resources, + "verbs" => Field::Key_verbs, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PolicyRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PolicyRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_groups: Option> = None; + let mut value_non_resource_urls: Option> = None; + let mut value_resource_names: Option> = None; + let mut value_resources: Option> = None; + let mut value_verbs: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_groups => value_api_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_non_resource_urls => value_non_resource_urls = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_names => value_resource_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PolicyRule { + api_groups: value_api_groups, + non_resource_urls: value_non_resource_urls, + resource_names: value_resource_names, + resources: value_resources, + verbs: value_verbs.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "PolicyRule", + &[ + "apiGroups", + "nonResourceURLs", + "resourceNames", + "resources", + "verbs", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PolicyRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PolicyRule", + 1 + + self.api_groups.as_ref().map_or(0, |_| 1) + + self.non_resource_urls.as_ref().map_or(0, |_| 1) + + self.resource_names.as_ref().map_or(0, |_| 1) + + self.resources.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_groups { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroups", value)?; + } + if let Some(value) = &self.non_resource_urls { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nonResourceURLs", value)?; + } + if let Some(value) = &self.resource_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceNames", value)?; + } + if let Some(value) = &self.resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PolicyRule { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.PolicyRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "nonResourceURLs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resources is a list of resources this rule applies to. '*' represents all resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/role.rs b/src/v1_30/api/rbac/v1/role.rs new file mode 100644 index 000000000..b5ac25bdd --- /dev/null +++ b/src/v1_30/api/rbac/v1/role.rs @@ -0,0 +1,224 @@ +// Generated from definition io.k8s.api.rbac.v1.Role + +/// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Role { + /// Standard object's metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Rules holds all the PolicyRules for this Role + pub rules: Option>, +} + +impl crate::Resource for Role { + const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1"; + const GROUP: &'static str = "rbac.authorization.k8s.io"; + const KIND: &'static str = "Role"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "roles"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for Role { + const LIST_KIND: &'static str = "RoleList"; +} + +impl crate::Metadata for Role { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Role { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.rules, other.rules); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Role { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_rules, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "rules" => Field::Key_rules, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Role; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_rules: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rules => value_rules = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Role { + metadata: value_metadata.unwrap_or_default(), + rules: value_rules, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "rules", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Role { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.rules.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.rules { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rules", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Role { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.Role".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "rules".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rules holds all the PolicyRules for this Role".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/role_binding.rs b/src/v1_30/api/rbac/v1/role_binding.rs new file mode 100644 index 000000000..308078f4d --- /dev/null +++ b/src/v1_30/api/rbac/v1/role_binding.rs @@ -0,0 +1,247 @@ +// Generated from definition io.k8s.api.rbac.v1.RoleBinding + +/// RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RoleBinding { + /// Standard object's metadata. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable. + pub role_ref: crate::api::rbac::v1::RoleRef, + + /// Subjects holds references to the objects the role applies to. + pub subjects: Option>, +} + +impl crate::Resource for RoleBinding { + const API_VERSION: &'static str = "rbac.authorization.k8s.io/v1"; + const GROUP: &'static str = "rbac.authorization.k8s.io"; + const KIND: &'static str = "RoleBinding"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "rolebindings"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for RoleBinding { + const LIST_KIND: &'static str = "RoleBindingList"; +} + +impl crate::Metadata for RoleBinding { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for RoleBinding { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.role_ref, other.role_ref); + crate::merge_strategies::list::atomic(&mut self.subjects, other.subjects); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RoleBinding { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_role_ref, + Key_subjects, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "roleRef" => Field::Key_role_ref, + "subjects" => Field::Key_subjects, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RoleBinding; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_role_ref: Option = None; + let mut value_subjects: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_role_ref => value_role_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subjects => value_subjects = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RoleBinding { + metadata: value_metadata.unwrap_or_default(), + role_ref: value_role_ref.unwrap_or_default(), + subjects: value_subjects, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "roleRef", + "subjects", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RoleBinding { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.subjects.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "roleRef", &self.role_ref)?; + if let Some(value) = &self.subjects { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subjects", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RoleBinding { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.RoleBinding".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "roleRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "subjects".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subjects holds references to the objects the role applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "roleRef".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/role_ref.rs b/src/v1_30/api/rbac/v1/role_ref.rs new file mode 100644 index 000000000..5873e8921 --- /dev/null +++ b/src/v1_30/api/rbac/v1/role_ref.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.rbac.v1.RoleRef + +/// RoleRef contains information that points to the role being used +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RoleRef { + /// APIGroup is the group for the resource being referenced + pub api_group: String, + + /// Kind is the type of resource being referenced + pub kind: String, + + /// Name is the name of resource being referenced + pub name: String, +} + +impl crate::DeepMerge for RoleRef { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RoleRef { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RoleRef; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RoleRef") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(RoleRef { + api_group: value_api_group.unwrap_or_default(), + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "RoleRef", + &[ + "apiGroup", + "kind", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for RoleRef { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "RoleRef", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", &self.api_group)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RoleRef { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.RoleRef".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RoleRef contains information that points to the role being used".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the type of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "apiGroup".to_owned(), + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/rbac/v1/subject.rs b/src/v1_30/api/rbac/v1/subject.rs new file mode 100644 index 000000000..30b29a672 --- /dev/null +++ b/src/v1_30/api/rbac/v1/subject.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.rbac.v1.Subject + +/// Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Subject { + /// APIGroup holds the API group of the referenced subject. Defaults to "" for ServiceAccount subjects. Defaults to "rbac.authorization.k8s.io" for User and Group subjects. + pub api_group: Option, + + /// Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". If the Authorizer does not recognized the kind value, the Authorizer should report an error. + pub kind: String, + + /// Name of the object being referenced. + pub name: String, + + /// Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty the Authorizer should report an error. + pub namespace: Option, +} + +impl crate::DeepMerge for Subject { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Subject { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Subject; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Subject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Subject { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespace: value_namespace, + }) + } + } + + deserializer.deserialize_struct( + "Subject", + &[ + "apiGroup", + "kind", + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Subject { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Subject", + 2 + + self.api_group.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Subject { + fn schema_name() -> String { + "io.k8s.api.rbac.v1.Subject".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the object being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/mod.rs b/src/v1_30/api/resource/mod.rs new file mode 100644 index 000000000..dda13c16f --- /dev/null +++ b/src/v1_30/api/resource/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha2; diff --git a/src/v1_30/api/resource/v1alpha2/allocation_result.rs b/src/v1_30/api/resource/v1alpha2/allocation_result.rs new file mode 100644 index 000000000..7f33494e4 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/allocation_result.rs @@ -0,0 +1,185 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.AllocationResult + +/// AllocationResult contains attributes of an allocated resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AllocationResult { + /// This field will get set by the resource driver after it has allocated the resource to inform the scheduler where it can schedule Pods using the ResourceClaim. + /// + /// Setting this field is optional. If null, the resource is available everywhere. + pub available_on_nodes: Option, + + /// ResourceHandles contain the state associated with an allocation that should be maintained throughout the lifetime of a claim. Each ResourceHandle contains data that should be passed to a specific kubelet plugin once it lands on a node. This data is returned by the driver after a successful allocation and is opaque to Kubernetes. Driver documentation may explain to users how to interpret this data if needed. + /// + /// Setting this field is optional. It has a maximum size of 32 entries. If null (or empty), it is assumed this allocation will be processed by a single kubelet plugin with no ResourceHandle data attached. The name of the kubelet plugin invoked will match the DriverName set in the ResourceClaimStatus this AllocationResult is embedded in. + pub resource_handles: Option>, + + /// Shareable determines whether the resource supports more than one consumer at a time. + pub shareable: Option, +} + +impl crate::DeepMerge for AllocationResult { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.available_on_nodes, other.available_on_nodes); + crate::merge_strategies::list::atomic(&mut self.resource_handles, other.resource_handles); + crate::DeepMerge::merge_from(&mut self.shareable, other.shareable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for AllocationResult { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_available_on_nodes, + Key_resource_handles, + Key_shareable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "availableOnNodes" => Field::Key_available_on_nodes, + "resourceHandles" => Field::Key_resource_handles, + "shareable" => Field::Key_shareable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = AllocationResult; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("AllocationResult") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_available_on_nodes: Option = None; + let mut value_resource_handles: Option> = None; + let mut value_shareable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_available_on_nodes => value_available_on_nodes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_handles => value_resource_handles = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_shareable => value_shareable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(AllocationResult { + available_on_nodes: value_available_on_nodes, + resource_handles: value_resource_handles, + shareable: value_shareable, + }) + } + } + + deserializer.deserialize_struct( + "AllocationResult", + &[ + "availableOnNodes", + "resourceHandles", + "shareable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for AllocationResult { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "AllocationResult", + self.available_on_nodes.as_ref().map_or(0, |_| 1) + + self.resource_handles.as_ref().map_or(0, |_| 1) + + self.shareable.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.available_on_nodes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "availableOnNodes", value)?; + } + if let Some(value) = &self.resource_handles { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceHandles", value)?; + } + if let Some(value) = &self.shareable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shareable", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for AllocationResult { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.AllocationResult".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("AllocationResult contains attributes of an allocated resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "availableOnNodes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("This field will get set by the resource driver after it has allocated the resource to inform the scheduler where it can schedule Pods using the ResourceClaim.\n\nSetting this field is optional. If null, the resource is available everywhere.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceHandles".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceHandles contain the state associated with an allocation that should be maintained throughout the lifetime of a claim. Each ResourceHandle contains data that should be passed to a specific kubelet plugin once it lands on a node. This data is returned by the driver after a successful allocation and is opaque to Kubernetes. Driver documentation may explain to users how to interpret this data if needed.\n\nSetting this field is optional. It has a maximum size of 32 entries. If null (or empty), it is assumed this allocation will be processed by a single kubelet plugin with no ResourceHandle data attached. The name of the kubelet plugin invoked will match the DriverName set in the ResourceClaimStatus this AllocationResult is embedded in.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "shareable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Shareable determines whether the resource supports more than one consumer at a time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/driver_allocation_result.rs b/src/v1_30/api/resource/v1alpha2/driver_allocation_result.rs new file mode 100644 index 000000000..5bf066a67 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/driver_allocation_result.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.DriverAllocationResult + +/// DriverAllocationResult contains vendor parameters and the allocation result for one request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DriverAllocationResult { + /// NamedResources describes the allocation result when using the named resources model. + pub named_resources: Option, + + /// VendorRequestParameters are the per-request configuration parameters from the time that the claim was allocated. + pub vendor_request_parameters: Option, +} + +impl crate::DeepMerge for DriverAllocationResult { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.named_resources, other.named_resources); + crate::DeepMerge::merge_from(&mut self.vendor_request_parameters, other.vendor_request_parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DriverAllocationResult { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_named_resources, + Key_vendor_request_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "namedResources" => Field::Key_named_resources, + "vendorRequestParameters" => Field::Key_vendor_request_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DriverAllocationResult; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DriverAllocationResult") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_named_resources: Option = None; + let mut value_vendor_request_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_named_resources => value_named_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_request_parameters => value_vendor_request_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DriverAllocationResult { + named_resources: value_named_resources, + vendor_request_parameters: value_vendor_request_parameters, + }) + } + } + + deserializer.deserialize_struct( + "DriverAllocationResult", + &[ + "namedResources", + "vendorRequestParameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DriverAllocationResult { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DriverAllocationResult", + self.named_resources.as_ref().map_or(0, |_| 1) + + self.vendor_request_parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.named_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namedResources", value)?; + } + if let Some(value) = &self.vendor_request_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorRequestParameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DriverAllocationResult { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.DriverAllocationResult".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverAllocationResult contains vendor parameters and the allocation result for one request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "namedResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResources describes the allocation result when using the named resources model.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "vendorRequestParameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorRequestParameters are the per-request configuration parameters from the time that the claim was allocated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/driver_requests.rs b/src/v1_30/api/resource/v1alpha2/driver_requests.rs new file mode 100644 index 000000000..b23faed22 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/driver_requests.rs @@ -0,0 +1,181 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.DriverRequests + +/// DriverRequests describes all resources that are needed from one particular driver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DriverRequests { + /// DriverName is the name used by the DRA driver kubelet plugin. + pub driver_name: Option, + + /// Requests describes all resources that are needed from the driver. + pub requests: Option>, + + /// VendorParameters are arbitrary setup parameters for all requests of the claim. They are ignored while allocating the claim. + pub vendor_parameters: Option, +} + +impl crate::DeepMerge for DriverRequests { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::merge_strategies::list::atomic(&mut self.requests, other.requests); + crate::DeepMerge::merge_from(&mut self.vendor_parameters, other.vendor_parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DriverRequests { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver_name, + Key_requests, + Key_vendor_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driverName" => Field::Key_driver_name, + "requests" => Field::Key_requests, + "vendorParameters" => Field::Key_vendor_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DriverRequests; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DriverRequests") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_requests: Option> = None; + let mut value_vendor_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_requests => value_requests = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_parameters => value_vendor_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DriverRequests { + driver_name: value_driver_name, + requests: value_requests, + vendor_parameters: value_vendor_parameters, + }) + } + } + + deserializer.deserialize_struct( + "DriverRequests", + &[ + "driverName", + "requests", + "vendorParameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DriverRequests { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DriverRequests", + self.driver_name.as_ref().map_or(0, |_| 1) + + self.requests.as_ref().map_or(0, |_| 1) + + self.vendor_parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.driver_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", value)?; + } + if let Some(value) = &self.requests { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requests", value)?; + } + if let Some(value) = &self.vendor_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorParameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DriverRequests { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.DriverRequests".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverRequests describes all resources that are needed from one particular driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName is the name used by the DRA driver kubelet plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "requests".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Requests describes all resources that are needed from the driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "vendorParameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorParameters are arbitrary setup parameters for all requests of the claim. They are ignored while allocating the claim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/mod.rs b/src/v1_30/api/resource/v1alpha2/mod.rs new file mode 100644 index 000000000..3a8316214 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/mod.rs @@ -0,0 +1,96 @@ + +mod allocation_result; +pub use self::allocation_result::AllocationResult; + +mod driver_allocation_result; +pub use self::driver_allocation_result::DriverAllocationResult; + +mod driver_requests; +pub use self::driver_requests::DriverRequests; + +mod named_resources_allocation_result; +pub use self::named_resources_allocation_result::NamedResourcesAllocationResult; + +mod named_resources_attribute; +pub use self::named_resources_attribute::NamedResourcesAttribute; + +mod named_resources_filter; +pub use self::named_resources_filter::NamedResourcesFilter; + +mod named_resources_instance; +pub use self::named_resources_instance::NamedResourcesInstance; + +mod named_resources_int_slice; +pub use self::named_resources_int_slice::NamedResourcesIntSlice; + +mod named_resources_request; +pub use self::named_resources_request::NamedResourcesRequest; + +mod named_resources_resources; +pub use self::named_resources_resources::NamedResourcesResources; + +mod named_resources_string_slice; +pub use self::named_resources_string_slice::NamedResourcesStringSlice; + +mod pod_scheduling_context; +pub use self::pod_scheduling_context::PodSchedulingContext; + +mod pod_scheduling_context_spec; +pub use self::pod_scheduling_context_spec::PodSchedulingContextSpec; + +mod pod_scheduling_context_status; +pub use self::pod_scheduling_context_status::PodSchedulingContextStatus; + +mod resource_claim; +pub use self::resource_claim::ResourceClaim; + +mod resource_claim_consumer_reference; +pub use self::resource_claim_consumer_reference::ResourceClaimConsumerReference; + +mod resource_claim_parameters; +pub use self::resource_claim_parameters::ResourceClaimParameters; + +mod resource_claim_parameters_reference; +pub use self::resource_claim_parameters_reference::ResourceClaimParametersReference; + +mod resource_claim_scheduling_status; +pub use self::resource_claim_scheduling_status::ResourceClaimSchedulingStatus; + +mod resource_claim_spec; +pub use self::resource_claim_spec::ResourceClaimSpec; + +mod resource_claim_status; +pub use self::resource_claim_status::ResourceClaimStatus; + +mod resource_claim_template; +pub use self::resource_claim_template::ResourceClaimTemplate; + +mod resource_claim_template_spec; +pub use self::resource_claim_template_spec::ResourceClaimTemplateSpec; + +mod resource_class; +pub use self::resource_class::ResourceClass; + +mod resource_class_parameters; +pub use self::resource_class_parameters::ResourceClassParameters; + +mod resource_class_parameters_reference; +pub use self::resource_class_parameters_reference::ResourceClassParametersReference; + +mod resource_filter; +pub use self::resource_filter::ResourceFilter; + +mod resource_handle; +pub use self::resource_handle::ResourceHandle; + +mod resource_request; +pub use self::resource_request::ResourceRequest; + +mod resource_slice; +pub use self::resource_slice::ResourceSlice; + +mod structured_resource_handle; +pub use self::structured_resource_handle::StructuredResourceHandle; + +mod vendor_parameters; +pub use self::vendor_parameters::VendorParameters; diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_allocation_result.rs b/src/v1_30/api/resource/v1alpha2/named_resources_allocation_result.rs new file mode 100644 index 000000000..4e12a8373 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_allocation_result.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult + +/// NamedResourcesAllocationResult is used in AllocationResultModel. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesAllocationResult { + /// Name is the name of the selected resource instance. + pub name: String, +} + +impl crate::DeepMerge for NamedResourcesAllocationResult { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesAllocationResult { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesAllocationResult; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesAllocationResult") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesAllocationResult { + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesAllocationResult", + &[ + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesAllocationResult { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesAllocationResult", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesAllocationResult { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesAllocationResult is used in AllocationResultModel.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the selected resource instance.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_attribute.rs b/src/v1_30/api/resource/v1alpha2/named_resources_attribute.rs new file mode 100644 index 000000000..2ed25cf2f --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_attribute.rs @@ -0,0 +1,304 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesAttribute + +/// NamedResourcesAttribute is a combination of an attribute name and its value. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesAttribute { + /// BoolValue is a true/false value. + pub bool: Option, + + /// IntValue is a 64-bit integer. + pub int: Option, + + /// IntSliceValue is an array of 64-bit integers. + pub int_slice: Option, + + /// Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain. + pub name: String, + + /// QuantityValue is a quantity. + pub quantity: Option, + + /// StringValue is a string. + pub string: Option, + + /// StringSliceValue is an array of strings. + pub string_slice: Option, + + /// VersionValue is a semantic version according to semver.org spec 2.0.0. + pub version: Option, +} + +impl crate::DeepMerge for NamedResourcesAttribute { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.bool, other.bool); + crate::DeepMerge::merge_from(&mut self.int, other.int); + crate::DeepMerge::merge_from(&mut self.int_slice, other.int_slice); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.quantity, other.quantity); + crate::DeepMerge::merge_from(&mut self.string, other.string); + crate::DeepMerge::merge_from(&mut self.string_slice, other.string_slice); + crate::DeepMerge::merge_from(&mut self.version, other.version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesAttribute { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_bool, + Key_int, + Key_int_slice, + Key_name, + Key_quantity, + Key_string, + Key_string_slice, + Key_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "bool" => Field::Key_bool, + "int" => Field::Key_int, + "intSlice" => Field::Key_int_slice, + "name" => Field::Key_name, + "quantity" => Field::Key_quantity, + "string" => Field::Key_string, + "stringSlice" => Field::Key_string_slice, + "version" => Field::Key_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesAttribute; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesAttribute") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_bool: Option = None; + let mut value_int: Option = None; + let mut value_int_slice: Option = None; + let mut value_name: Option = None; + let mut value_quantity: Option = None; + let mut value_string: Option = None; + let mut value_string_slice: Option = None; + let mut value_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_bool => value_bool = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_int => value_int = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_int_slice => value_int_slice = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_quantity => value_quantity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_string => value_string = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_string_slice => value_string_slice = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesAttribute { + bool: value_bool, + int: value_int, + int_slice: value_int_slice, + name: value_name.unwrap_or_default(), + quantity: value_quantity, + string: value_string, + string_slice: value_string_slice, + version: value_version, + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesAttribute", + &[ + "bool", + "int", + "intSlice", + "name", + "quantity", + "string", + "stringSlice", + "version", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesAttribute { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesAttribute", + 1 + + self.bool.as_ref().map_or(0, |_| 1) + + self.int.as_ref().map_or(0, |_| 1) + + self.int_slice.as_ref().map_or(0, |_| 1) + + self.quantity.as_ref().map_or(0, |_| 1) + + self.string.as_ref().map_or(0, |_| 1) + + self.string_slice.as_ref().map_or(0, |_| 1) + + self.version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.bool { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "bool", value)?; + } + if let Some(value) = &self.int { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "int", value)?; + } + if let Some(value) = &self.int_slice { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "intSlice", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.quantity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quantity", value)?; + } + if let Some(value) = &self.string { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "string", value)?; + } + if let Some(value) = &self.string_slice { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "stringSlice", value)?; + } + if let Some(value) = &self.version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesAttribute { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesAttribute".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesAttribute is a combination of an attribute name and its value.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "bool".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("BoolValue is a true/false value.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "int".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IntValue is a 64-bit integer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "intSlice".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IntSliceValue is an array of 64-bit integers.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "quantity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("QuantityValue is a quantity.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "string".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StringValue is a string.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "stringSlice".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StringSliceValue is an array of strings.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VersionValue is a semantic version according to semver.org spec 2.0.0.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_filter.rs b/src/v1_30/api/resource/v1alpha2/named_resources_filter.rs new file mode 100644 index 000000000..6394dd6d6 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_filter.rs @@ -0,0 +1,133 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesFilter + +/// NamedResourcesFilter is used in ResourceFilterModel. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesFilter { + /// Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/ + /// + /// In addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example: + /// + /// attributes.quantity\["a"\].isGreaterThan(quantity("0")) && + /// attributes.stringslice\["b"\].isSorted() + pub selector: String, +} + +impl crate::DeepMerge for NamedResourcesFilter { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesFilter { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesFilter; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesFilter") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesFilter { + selector: value_selector.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesFilter", + &[ + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesFilter { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesFilter", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesFilter { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesFilter".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesFilter is used in ResourceFilterModel.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "selector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "selector".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_instance.rs b/src/v1_30/api/resource/v1alpha2/named_resources_instance.rs new file mode 100644 index 000000000..c2252516d --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_instance.rs @@ -0,0 +1,157 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesInstance + +/// NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesInstance { + /// Attributes defines the attributes of this resource instance. The name of each attribute must be unique. + pub attributes: Option>, + + /// Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain. + pub name: String, +} + +impl crate::DeepMerge for NamedResourcesInstance { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.attributes, other.attributes); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesInstance { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_attributes, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "attributes" => Field::Key_attributes, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesInstance; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesInstance") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_attributes: Option> = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_attributes => value_attributes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesInstance { + attributes: value_attributes, + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesInstance", + &[ + "attributes", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesInstance { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesInstance", + 1 + + self.attributes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.attributes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attributes", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesInstance { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesInstance".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "attributes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Attributes defines the attributes of this resource instance. The name of each attribute must be unique.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_int_slice.rs b/src/v1_30/api/resource/v1alpha2/named_resources_int_slice.rs new file mode 100644 index 000000000..a0ef41184 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_int_slice.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice + +/// NamedResourcesIntSlice contains a slice of 64-bit integers. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesIntSlice { + /// Ints is the slice of 64-bit integers. + pub ints: Vec, +} + +impl crate::DeepMerge for NamedResourcesIntSlice { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.ints, other.ints); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesIntSlice { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ints, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ints" => Field::Key_ints, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesIntSlice; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesIntSlice") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ints: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ints => value_ints = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesIntSlice { + ints: value_ints.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesIntSlice", + &[ + "ints", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesIntSlice { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesIntSlice", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ints", &self.ints)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesIntSlice { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesIntSlice contains a slice of 64-bit integers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "ints".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Ints is the slice of 64-bit integers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "ints".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_request.rs b/src/v1_30/api/resource/v1alpha2/named_resources_request.rs new file mode 100644 index 000000000..b17fb8b7f --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_request.rs @@ -0,0 +1,133 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesRequest + +/// NamedResourcesRequest is used in ResourceRequestModel. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesRequest { + /// Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/ + /// + /// In addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example: + /// + /// attributes.quantity\["a"\].isGreaterThan(quantity("0")) && + /// attributes.stringslice\["b"\].isSorted() + pub selector: String, +} + +impl crate::DeepMerge for NamedResourcesRequest { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.selector, other.selector); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesRequest { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_selector, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "selector" => Field::Key_selector, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesRequest; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesRequest") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_selector: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_selector => value_selector = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesRequest { + selector: value_selector.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesRequest", + &[ + "selector", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesRequest { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesRequest", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selector", &self.selector)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesRequest { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesRequest".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesRequest is used in ResourceRequestModel.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "selector".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "selector".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_resources.rs b/src/v1_30/api/resource/v1alpha2/named_resources_resources.rs new file mode 100644 index 000000000..212fbb07c --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_resources.rs @@ -0,0 +1,132 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesResources + +/// NamedResourcesResources is used in ResourceModel. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesResources { + /// The list of all individual resources instances currently available. + pub instances: Vec, +} + +impl crate::DeepMerge for NamedResourcesResources { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.instances, other.instances); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesResources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_instances, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "instances" => Field::Key_instances, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesResources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesResources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_instances: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_instances => value_instances = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesResources { + instances: value_instances.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesResources", + &[ + "instances", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesResources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesResources", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "instances", &self.instances)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesResources { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesResources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesResources is used in ResourceModel.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "instances".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The list of all individual resources instances currently available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "instances".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/named_resources_string_slice.rs b/src/v1_30/api/resource/v1alpha2/named_resources_string_slice.rs new file mode 100644 index 000000000..026857654 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/named_resources_string_slice.rs @@ -0,0 +1,137 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice + +/// NamedResourcesStringSlice contains a slice of strings. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct NamedResourcesStringSlice { + /// Strings is the slice of strings. + pub strings: Vec, +} + +impl crate::DeepMerge for NamedResourcesStringSlice { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.strings, other.strings); + } +} + +impl<'de> crate::serde::Deserialize<'de> for NamedResourcesStringSlice { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_strings, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "strings" => Field::Key_strings, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = NamedResourcesStringSlice; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("NamedResourcesStringSlice") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_strings: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_strings => value_strings = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(NamedResourcesStringSlice { + strings: value_strings.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "NamedResourcesStringSlice", + &[ + "strings", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for NamedResourcesStringSlice { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "NamedResourcesStringSlice", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "strings", &self.strings)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for NamedResourcesStringSlice { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResourcesStringSlice contains a slice of strings.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "strings".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Strings is the slice of strings.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "strings".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/pod_scheduling_context.rs b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context.rs new file mode 100644 index 000000000..079051381 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.PodSchedulingContext + +/// PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use "WaitForFirstConsumer" allocation mode. +/// +/// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSchedulingContext { + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec describes where resources for the Pod are needed. + pub spec: crate::api::resource::v1alpha2::PodSchedulingContextSpec, + + /// Status describes where resources for the Pod can be allocated. + pub status: Option, +} + +impl crate::Resource for PodSchedulingContext { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "PodSchedulingContext"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "podschedulingcontexts"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for PodSchedulingContext { + const LIST_KIND: &'static str = "PodSchedulingContextList"; +} + +impl crate::Metadata for PodSchedulingContext { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PodSchedulingContext { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSchedulingContext { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSchedulingContext; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSchedulingContext { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSchedulingContext { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSchedulingContext { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.PodSchedulingContext".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use \"WaitForFirstConsumer\" allocation mode.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec describes where resources for the Pod are needed.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status describes where resources for the Pod can be allocated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_spec.rs b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_spec.rs new file mode 100644 index 000000000..35e23770b --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_spec.rs @@ -0,0 +1,163 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.PodSchedulingContextSpec + +/// PodSchedulingContextSpec describes where resources for the Pod are needed. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSchedulingContextSpec { + /// PotentialNodes lists nodes where the Pod might be able to run. + /// + /// The size of this field is limited to 128. This is large enough for many clusters. Larger clusters may need more attempts to find a node that suits all pending resources. This may get increased in the future, but not reduced. + pub potential_nodes: Option>, + + /// SelectedNode is the node for which allocation of ResourceClaims that are referenced by the Pod and that use "WaitForFirstConsumer" allocation is to be attempted. + pub selected_node: Option, +} + +impl crate::DeepMerge for PodSchedulingContextSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.potential_nodes, other.potential_nodes); + crate::DeepMerge::merge_from(&mut self.selected_node, other.selected_node); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSchedulingContextSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_potential_nodes, + Key_selected_node, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "potentialNodes" => Field::Key_potential_nodes, + "selectedNode" => Field::Key_selected_node, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSchedulingContextSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodSchedulingContextSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_potential_nodes: Option> = None; + let mut value_selected_node: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_potential_nodes => value_potential_nodes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selected_node => value_selected_node = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSchedulingContextSpec { + potential_nodes: value_potential_nodes, + selected_node: value_selected_node, + }) + } + } + + deserializer.deserialize_struct( + "PodSchedulingContextSpec", + &[ + "potentialNodes", + "selectedNode", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSchedulingContextSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodSchedulingContextSpec", + self.potential_nodes.as_ref().map_or(0, |_| 1) + + self.selected_node.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.potential_nodes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "potentialNodes", value)?; + } + if let Some(value) = &self.selected_node { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selectedNode", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSchedulingContextSpec { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.PodSchedulingContextSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSchedulingContextSpec describes where resources for the Pod are needed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "potentialNodes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PotentialNodes lists nodes where the Pod might be able to run.\n\nThe size of this field is limited to 128. This is large enough for many clusters. Larger clusters may need more attempts to find a node that suits all pending resources. This may get increased in the future, but not reduced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "selectedNode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelectedNode is the node for which allocation of ResourceClaims that are referenced by the Pod and that use \"WaitForFirstConsumer\" allocation is to be attempted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_status.rs b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_status.rs new file mode 100644 index 000000000..88d8b73fd --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/pod_scheduling_context_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.PodSchedulingContextStatus + +/// PodSchedulingContextStatus describes where resources for the Pod can be allocated. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PodSchedulingContextStatus { + /// ResourceClaims describes resource availability for each pod.spec.resourceClaim entry where the corresponding ResourceClaim uses "WaitForFirstConsumer" allocation mode. + pub resource_claims: Option>, +} + +impl crate::DeepMerge for PodSchedulingContextStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.resource_claims, + other.resource_claims, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PodSchedulingContextStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_resource_claims, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "resourceClaims" => Field::Key_resource_claims, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PodSchedulingContextStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PodSchedulingContextStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_resource_claims: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_resource_claims => value_resource_claims = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PodSchedulingContextStatus { + resource_claims: value_resource_claims, + }) + } + } + + deserializer.deserialize_struct( + "PodSchedulingContextStatus", + &[ + "resourceClaims", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PodSchedulingContextStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "PodSchedulingContextStatus", + self.resource_claims.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.resource_claims { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClaims", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PodSchedulingContextStatus { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.PodSchedulingContextStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PodSchedulingContextStatus describes where resources for the Pod can be allocated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "resourceClaims".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaims describes resource availability for each pod.spec.resourceClaim entry where the corresponding ResourceClaim uses \"WaitForFirstConsumer\" allocation mode.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim.rs b/src/v1_30/api/resource/v1alpha2/resource_claim.rs new file mode 100644 index 000000000..a8e81951e --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaim + +/// ResourceClaim describes which resources are needed by a resource consumer. Its status tracks whether the resource has been allocated and what the resulting attributes are. +/// +/// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaim { + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim. + pub spec: crate::api::resource::v1alpha2::ResourceClaimSpec, + + /// Status describes whether the resource is available and with which attributes. + pub status: Option, +} + +impl crate::Resource for ResourceClaim { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceClaim"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceclaims"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ResourceClaim { + const LIST_KIND: &'static str = "ResourceClaimList"; +} + +impl crate::Metadata for ResourceClaim { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceClaim { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaim { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaim; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaim { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaim { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaim { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaim".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaim describes which resources are needed by a resource consumer. Its status tracks whether the resource has been allocated and what the resulting attributes are.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec describes the desired attributes of a resource that then needs to be allocated. It can only be set once when creating the ResourceClaim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status describes whether the resource is available and with which attributes.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_consumer_reference.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_consumer_reference.rs new file mode 100644 index 000000000..b3cc3a96c --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_consumer_reference.rs @@ -0,0 +1,199 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimConsumerReference + +/// ResourceClaimConsumerReference contains enough information to let you locate the consumer of a ResourceClaim. The user must be a resource in the same namespace as the ResourceClaim. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimConsumerReference { + /// APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources. + pub api_group: Option, + + /// Name is the name of resource being referenced. + pub name: String, + + /// Resource is the type of resource being referenced, for example "pods". + pub resource: String, + + /// UID identifies exactly one incarnation of the resource. + pub uid: String, +} + +impl crate::DeepMerge for ResourceClaimConsumerReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimConsumerReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_name, + Key_resource, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "name" => Field::Key_name, + "resource" => Field::Key_resource, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimConsumerReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimConsumerReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_name: Option = None; + let mut value_resource: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimConsumerReference { + api_group: value_api_group, + name: value_name.unwrap_or_default(), + resource: value_resource.unwrap_or_default(), + uid: value_uid.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimConsumerReference", + &[ + "apiGroup", + "name", + "resource", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimConsumerReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimConsumerReference", + 3 + + self.api_group.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", &self.resource)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", &self.uid)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimConsumerReference { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimConsumerReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimConsumerReference contains enough information to let you locate the consumer of a ResourceClaim. The user must be a resource in the same namespace as the ResourceClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Resource is the type of resource being referenced, for example \"pods\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID identifies exactly one incarnation of the resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "resource".to_owned(), + "uid".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_parameters.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_parameters.rs new file mode 100644 index 000000000..d4fe5e421 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_parameters.rs @@ -0,0 +1,276 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimParameters + +/// ResourceClaimParameters defines resource requests for a ResourceClaim in an in-tree format understood by Kubernetes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimParameters { + /// DriverRequests describes all resources that are needed for the allocated claim. A single claim may use resources coming from different drivers. For each driver, this array has at most one entry which then may have one or more per-driver requests. + /// + /// May be empty, in which case the claim can always be allocated. + pub driver_requests: Option>, + + /// If this object was created from some other resource, then this links back to that resource. This field is used to find the in-tree representation of the claim parameters when the parameter reference of the claim refers to some unknown type. + pub generated_from: Option, + + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Shareable indicates whether the allocated claim is meant to be shareable by multiple consumers at the same time. + pub shareable: Option, +} + +impl crate::Resource for ResourceClaimParameters { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceClaimParameters"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceclaimparameters"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ResourceClaimParameters { + const LIST_KIND: &'static str = "ResourceClaimParametersList"; +} + +impl crate::Metadata for ResourceClaimParameters { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceClaimParameters { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.driver_requests, other.driver_requests); + crate::DeepMerge::merge_from(&mut self.generated_from, other.generated_from); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.shareable, other.shareable); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimParameters { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_driver_requests, + Key_generated_from, + Key_metadata, + Key_shareable, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "driverRequests" => Field::Key_driver_requests, + "generatedFrom" => Field::Key_generated_from, + "metadata" => Field::Key_metadata, + "shareable" => Field::Key_shareable, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimParameters; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_requests: Option> = None; + let mut value_generated_from: Option = None; + let mut value_metadata: Option = None; + let mut value_shareable: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_driver_requests => value_driver_requests = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_generated_from => value_generated_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_shareable => value_shareable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimParameters { + driver_requests: value_driver_requests, + generated_from: value_generated_from, + metadata: value_metadata.unwrap_or_default(), + shareable: value_shareable, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "driverRequests", + "generatedFrom", + "metadata", + "shareable", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimParameters { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.driver_requests.as_ref().map_or(0, |_| 1) + + self.generated_from.as_ref().map_or(0, |_| 1) + + self.shareable.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.driver_requests { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverRequests", value)?; + } + if let Some(value) = &self.generated_from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "generatedFrom", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.shareable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shareable", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimParameters { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimParameters".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimParameters defines resource requests for a ResourceClaim in an in-tree format understood by Kubernetes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "driverRequests".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverRequests describes all resources that are needed for the allocated claim. A single claim may use resources coming from different drivers. For each driver, this array has at most one entry which then may have one or more per-driver requests.\n\nMay be empty, in which case the claim can always be allocated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "generatedFrom".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If this object was created from some other resource, then this links back to that resource. This field is used to find the in-tree representation of the claim parameters when the parameter reference of the claim refers to some unknown type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "shareable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Shareable indicates whether the allocated claim is meant to be shareable by multiple consumers at the same time.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_parameters_reference.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_parameters_reference.rs new file mode 100644 index 000000000..1e80739cb --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_parameters_reference.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimParametersReference + +/// ResourceClaimParametersReference contains enough information to let you locate the parameters for a ResourceClaim. The object must be in the same namespace as the ResourceClaim. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimParametersReference { + /// APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources. + pub api_group: Option, + + /// Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata, for example "ConfigMap". + pub kind: String, + + /// Name is the name of resource being referenced. + pub name: String, +} + +impl crate::DeepMerge for ResourceClaimParametersReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimParametersReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimParametersReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimParametersReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimParametersReference { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimParametersReference", + &[ + "apiGroup", + "kind", + "name", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimParametersReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimParametersReference", + 2 + + self.api_group.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimParametersReference { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimParametersReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimParametersReference contains enough information to let you locate the parameters for a ResourceClaim. The object must be in the same namespace as the ResourceClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata, for example \"ConfigMap\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_scheduling_status.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_scheduling_status.rs new file mode 100644 index 000000000..ecef343c4 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_scheduling_status.rs @@ -0,0 +1,163 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimSchedulingStatus + +/// ResourceClaimSchedulingStatus contains information about one particular ResourceClaim with "WaitForFirstConsumer" allocation mode. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimSchedulingStatus { + /// Name matches the pod.spec.resourceClaims\[*\].Name field. + pub name: Option, + + /// UnsuitableNodes lists nodes that the ResourceClaim cannot be allocated for. + /// + /// The size of this field is limited to 128, the same as for PodSchedulingSpec.PotentialNodes. This may get increased in the future, but not reduced. + pub unsuitable_nodes: Option>, +} + +impl crate::DeepMerge for ResourceClaimSchedulingStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::merge_strategies::list::atomic(&mut self.unsuitable_nodes, other.unsuitable_nodes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimSchedulingStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_unsuitable_nodes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "unsuitableNodes" => Field::Key_unsuitable_nodes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimSchedulingStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimSchedulingStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_unsuitable_nodes: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_unsuitable_nodes => value_unsuitable_nodes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimSchedulingStatus { + name: value_name, + unsuitable_nodes: value_unsuitable_nodes, + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimSchedulingStatus", + &[ + "name", + "unsuitableNodes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimSchedulingStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimSchedulingStatus", + self.name.as_ref().map_or(0, |_| 1) + + self.unsuitable_nodes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.unsuitable_nodes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "unsuitableNodes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimSchedulingStatus { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimSchedulingStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimSchedulingStatus contains information about one particular ResourceClaim with \"WaitForFirstConsumer\" allocation mode.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name matches the pod.spec.resourceClaims[*].Name field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "unsuitableNodes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UnsuitableNodes lists nodes that the ResourceClaim cannot be allocated for.\n\nThe size of this field is limited to 128, the same as for PodSchedulingSpec.PotentialNodes. This may get increased in the future, but not reduced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_spec.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_spec.rs new file mode 100644 index 000000000..3d9d569a0 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_spec.rs @@ -0,0 +1,180 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimSpec + +/// ResourceClaimSpec defines how a resource is to be allocated. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimSpec { + /// Allocation can start immediately or when a Pod wants to use the resource. "WaitForFirstConsumer" is the default. + pub allocation_mode: Option, + + /// ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim. + /// + /// The object must be in the same namespace as the ResourceClaim. + pub parameters_ref: Option, + + /// ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment. + pub resource_class_name: String, +} + +impl crate::DeepMerge for ResourceClaimSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allocation_mode, other.allocation_mode); + crate::DeepMerge::merge_from(&mut self.parameters_ref, other.parameters_ref); + crate::DeepMerge::merge_from(&mut self.resource_class_name, other.resource_class_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allocation_mode, + Key_parameters_ref, + Key_resource_class_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allocationMode" => Field::Key_allocation_mode, + "parametersRef" => Field::Key_parameters_ref, + "resourceClassName" => Field::Key_resource_class_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allocation_mode: Option = None; + let mut value_parameters_ref: Option = None; + let mut value_resource_class_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allocation_mode => value_allocation_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters_ref => value_parameters_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_class_name => value_resource_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimSpec { + allocation_mode: value_allocation_mode, + parameters_ref: value_parameters_ref, + resource_class_name: value_resource_class_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimSpec", + &[ + "allocationMode", + "parametersRef", + "resourceClassName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimSpec", + 1 + + self.allocation_mode.as_ref().map_or(0, |_| 1) + + self.parameters_ref.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allocation_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocationMode", value)?; + } + if let Some(value) = &self.parameters_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parametersRef", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceClassName", &self.resource_class_name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimSpec { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimSpec defines how a resource is to be allocated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allocationMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parametersRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.\n\nThe object must be in the same namespace as the ResourceClaim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "resourceClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "resourceClassName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_status.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_status.rs new file mode 100644 index 000000000..40bb5f883 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_status.rs @@ -0,0 +1,219 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimStatus + +/// ResourceClaimStatus tracks whether the resource has been allocated and what the resulting attributes are. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimStatus { + /// Allocation is set by the resource driver once a resource or set of resources has been allocated successfully. If this is not specified, the resources have not been allocated yet. + pub allocation: Option, + + /// DeallocationRequested indicates that a ResourceClaim is to be deallocated. + /// + /// The driver then must deallocate this claim and reset the field together with clearing the Allocation field. + /// + /// While DeallocationRequested is set, no new consumers may be added to ReservedFor. + pub deallocation_requested: Option, + + /// DriverName is a copy of the driver name from the ResourceClass at the time when allocation started. + pub driver_name: Option, + + /// ReservedFor indicates which entities are currently allowed to use the claim. A Pod which references a ResourceClaim which is not reserved for that Pod will not be started. + /// + /// There can be at most 32 such reservations. This may get increased in the future, but not reduced. + pub reserved_for: Option>, +} + +impl crate::DeepMerge for ResourceClaimStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allocation, other.allocation); + crate::DeepMerge::merge_from(&mut self.deallocation_requested, other.deallocation_requested); + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::merge_strategies::list::map( + &mut self.reserved_for, + other.reserved_for, + &[|lhs, rhs| lhs.uid == rhs.uid], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allocation, + Key_deallocation_requested, + Key_driver_name, + Key_reserved_for, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allocation" => Field::Key_allocation, + "deallocationRequested" => Field::Key_deallocation_requested, + "driverName" => Field::Key_driver_name, + "reservedFor" => Field::Key_reserved_for, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allocation: Option = None; + let mut value_deallocation_requested: Option = None; + let mut value_driver_name: Option = None; + let mut value_reserved_for: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allocation => value_allocation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deallocation_requested => value_deallocation_requested = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reserved_for => value_reserved_for = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimStatus { + allocation: value_allocation, + deallocation_requested: value_deallocation_requested, + driver_name: value_driver_name, + reserved_for: value_reserved_for, + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimStatus", + &[ + "allocation", + "deallocationRequested", + "driverName", + "reservedFor", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimStatus", + self.allocation.as_ref().map_or(0, |_| 1) + + self.deallocation_requested.as_ref().map_or(0, |_| 1) + + self.driver_name.as_ref().map_or(0, |_| 1) + + self.reserved_for.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allocation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocation", value)?; + } + if let Some(value) = &self.deallocation_requested { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deallocationRequested", value)?; + } + if let Some(value) = &self.driver_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", value)?; + } + if let Some(value) = &self.reserved_for { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reservedFor", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimStatus { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimStatus tracks whether the resource has been allocated and what the resulting attributes are.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allocation".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Allocation is set by the resource driver once a resource or set of resources has been allocated successfully. If this is not specified, the resources have not been allocated yet.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "deallocationRequested".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeallocationRequested indicates that a ResourceClaim is to be deallocated.\n\nThe driver then must deallocate this claim and reset the field together with clearing the Allocation field.\n\nWhile DeallocationRequested is set, no new consumers may be added to ReservedFor.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName is a copy of the driver name from the ResourceClass at the time when allocation started.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reservedFor".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ReservedFor indicates which entities are currently allowed to use the claim. A Pod which references a ResourceClaim which is not reserved for that Pod will not be started.\n\nThere can be at most 32 such reservations. This may get increased in the future, but not reduced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_template.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_template.rs new file mode 100644 index 000000000..636cf5416 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_template.rs @@ -0,0 +1,220 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimTemplate + +/// ResourceClaimTemplate is used to produce ResourceClaim objects. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimTemplate { + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Describes the ResourceClaim that is to be generated. + /// + /// This field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore. + pub spec: crate::api::resource::v1alpha2::ResourceClaimTemplateSpec, +} + +impl crate::Resource for ResourceClaimTemplate { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceClaimTemplate"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceclaimtemplates"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ResourceClaimTemplate { + const LIST_KIND: &'static str = "ResourceClaimTemplateList"; +} + +impl crate::Metadata for ResourceClaimTemplate { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceClaimTemplate { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimTemplate { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimTemplate; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimTemplate { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimTemplate { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimTemplate { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimTemplate".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimTemplate is used to produce ResourceClaim objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes the ResourceClaim that is to be generated.\n\nThis field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_claim_template_spec.rs b/src/v1_30/api/resource/v1alpha2/resource_claim_template_spec.rs new file mode 100644 index 000000000..0f27dbb2a --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_claim_template_spec.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClaimTemplateSpec + +/// ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClaimTemplateSpec { + /// ObjectMeta may contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation. + pub metadata: Option, + + /// Spec for the ResourceClaim. The entire content is copied unchanged into the ResourceClaim that gets created from this template. The same fields as in a ResourceClaim are also valid here. + pub spec: crate::api::resource::v1alpha2::ResourceClaimSpec, +} + +impl crate::DeepMerge for ResourceClaimTemplateSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClaimTemplateSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClaimTemplateSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClaimTemplateSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClaimTemplateSpec { + metadata: value_metadata, + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ResourceClaimTemplateSpec", + &[ + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClaimTemplateSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClaimTemplateSpec", + 1 + + self.metadata.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.metadata { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClaimTemplateSpec { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClaimTemplateSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectMeta may contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec for the ResourceClaim. The entire content is copied unchanged into the ResourceClaim that gets created from this template. The same fields as in a ResourceClaim are also valid here.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_class.rs b/src/v1_30/api/resource/v1alpha2/resource_class.rs new file mode 100644 index 000000000..56309c612 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_class.rs @@ -0,0 +1,299 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClass + +/// ResourceClass is used by administrators to influence how resources are allocated. +/// +/// This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClass { + /// DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class. + /// + /// Resource drivers have a unique name in forward domain order (acme.example.com). + pub driver_name: String, + + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec. + pub parameters_ref: Option, + + /// If and only if allocation of claims using this class is handled via structured parameters, then StructuredParameters must be set to true. + pub structured_parameters: Option, + + /// Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet. + /// + /// Setting this field is optional. If null, all nodes are candidates. + pub suitable_nodes: Option, +} + +impl crate::Resource for ResourceClass { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceClass"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ResourceClass { + const LIST_KIND: &'static str = "ResourceClassList"; +} + +impl crate::Metadata for ResourceClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.parameters_ref, other.parameters_ref); + crate::DeepMerge::merge_from(&mut self.structured_parameters, other.structured_parameters); + crate::DeepMerge::merge_from(&mut self.suitable_nodes, other.suitable_nodes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_driver_name, + Key_metadata, + Key_parameters_ref, + Key_structured_parameters, + Key_suitable_nodes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "driverName" => Field::Key_driver_name, + "metadata" => Field::Key_metadata, + "parametersRef" => Field::Key_parameters_ref, + "structuredParameters" => Field::Key_structured_parameters, + "suitableNodes" => Field::Key_suitable_nodes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_metadata: Option = None; + let mut value_parameters_ref: Option = None; + let mut value_structured_parameters: Option = None; + let mut value_suitable_nodes: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters_ref => value_parameters_ref = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_structured_parameters => value_structured_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_suitable_nodes => value_suitable_nodes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClass { + driver_name: value_driver_name.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + parameters_ref: value_parameters_ref, + structured_parameters: value_structured_parameters, + suitable_nodes: value_suitable_nodes, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "driverName", + "metadata", + "parametersRef", + "structuredParameters", + "suitableNodes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.parameters_ref.as_ref().map_or(0, |_| 1) + + self.structured_parameters.as_ref().map_or(0, |_| 1) + + self.suitable_nodes.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", &self.driver_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.parameters_ref { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parametersRef", value)?; + } + if let Some(value) = &self.structured_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "structuredParameters", value)?; + } + if let Some(value) = &self.suitable_nodes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "suitableNodes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClass { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClass is used by administrators to influence how resources are allocated.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName defines the name of the dynamic resource driver that is used for allocation of a ResourceClaim that uses this class.\n\nResource drivers have a unique name in forward domain order (acme.example.com).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "parametersRef".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ParametersRef references an arbitrary separate object that may hold parameters that will be used by the driver when allocating a resource that uses this class. A dynamic resource driver can distinguish between parameters stored here and and those stored in ResourceClaimSpec.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "structuredParameters".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If and only if allocation of claims using this class is handled via structured parameters, then StructuredParameters must be set to true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "suitableNodes".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Only nodes matching the selector will be considered by the scheduler when trying to find a Node that fits a Pod when that Pod uses a ResourceClaim that has not been allocated yet.\n\nSetting this field is optional. If null, all nodes are candidates.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "driverName".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_class_parameters.rs b/src/v1_30/api/resource/v1alpha2/resource_class_parameters.rs new file mode 100644 index 000000000..a0473db97 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_class_parameters.rs @@ -0,0 +1,278 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClassParameters + +/// ResourceClassParameters defines resource requests for a ResourceClass in an in-tree format understood by Kubernetes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClassParameters { + /// Filters describes additional contraints that must be met when using the class. + pub filters: Option>, + + /// If this object was created from some other resource, then this links back to that resource. This field is used to find the in-tree representation of the class parameters when the parameter reference of the class refers to some unknown type. + pub generated_from: Option, + + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// VendorParameters are arbitrary setup parameters for all claims using this class. They are ignored while allocating the claim. There must not be more than one entry per driver. + pub vendor_parameters: Option>, +} + +impl crate::Resource for ResourceClassParameters { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceClassParameters"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceclassparameters"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for ResourceClassParameters { + const LIST_KIND: &'static str = "ResourceClassParametersList"; +} + +impl crate::Metadata for ResourceClassParameters { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceClassParameters { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.filters, other.filters); + crate::DeepMerge::merge_from(&mut self.generated_from, other.generated_from); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.vendor_parameters, other.vendor_parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClassParameters { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_filters, + Key_generated_from, + Key_metadata, + Key_vendor_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "filters" => Field::Key_filters, + "generatedFrom" => Field::Key_generated_from, + "metadata" => Field::Key_metadata, + "vendorParameters" => Field::Key_vendor_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClassParameters; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_filters: Option> = None; + let mut value_generated_from: Option = None; + let mut value_metadata: Option = None; + let mut value_vendor_parameters: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_filters => value_filters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_generated_from => value_generated_from = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_parameters => value_vendor_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClassParameters { + filters: value_filters, + generated_from: value_generated_from, + metadata: value_metadata.unwrap_or_default(), + vendor_parameters: value_vendor_parameters, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "filters", + "generatedFrom", + "metadata", + "vendorParameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClassParameters { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.filters.as_ref().map_or(0, |_| 1) + + self.generated_from.as_ref().map_or(0, |_| 1) + + self.vendor_parameters.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.filters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "filters", value)?; + } + if let Some(value) = &self.generated_from { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "generatedFrom", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.vendor_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorParameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClassParameters { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClassParameters".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClassParameters defines resource requests for a ResourceClass in an in-tree format understood by Kubernetes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "filters".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Filters describes additional contraints that must be met when using the class.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "generatedFrom".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If this object was created from some other resource, then this links back to that resource. This field is used to find the in-tree representation of the class parameters when the parameter reference of the class refers to some unknown type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "vendorParameters".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorParameters are arbitrary setup parameters for all claims using this class. They are ignored while allocating the claim. There must not be more than one entry per driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_class_parameters_reference.rs b/src/v1_30/api/resource/v1alpha2/resource_class_parameters_reference.rs new file mode 100644 index 000000000..b6d8e5e97 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_class_parameters_reference.rs @@ -0,0 +1,201 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceClassParametersReference + +/// ResourceClassParametersReference contains enough information to let you locate the parameters for a ResourceClass. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceClassParametersReference { + /// APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources. + pub api_group: Option, + + /// Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata. + pub kind: String, + + /// Name is the name of resource being referenced. + pub name: String, + + /// Namespace that contains the referenced resource. Must be empty for cluster-scoped resources and non-empty for namespaced resources. + pub namespace: Option, +} + +impl crate::DeepMerge for ResourceClassParametersReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_group, other.api_group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceClassParametersReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_group, + Key_kind, + Key_name, + Key_namespace, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiGroup" => Field::Key_api_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceClassParametersReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceClassParametersReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_group => value_api_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceClassParametersReference { + api_group: value_api_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespace: value_namespace, + }) + } + } + + deserializer.deserialize_struct( + "ResourceClassParametersReference", + &[ + "apiGroup", + "kind", + "name", + "namespace", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceClassParametersReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceClassParametersReference", + 2 + + self.api_group.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiGroup", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceClassParametersReference { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceClassParametersReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceClassParametersReference contains enough information to let you locate the parameters for a ResourceClass.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiGroup".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup is the group for the resource being referenced. It is empty for the core API. This matches the group in the APIVersion that is used when creating the resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind is the type of resource being referenced. This is the same value as in the parameter object's metadata.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of resource being referenced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace that contains the referenced resource. Must be empty for cluster-scoped resources and non-empty for namespaced resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_filter.rs b/src/v1_30/api/resource/v1alpha2/resource_filter.rs new file mode 100644 index 000000000..9797d81b7 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_filter.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceFilter + +/// ResourceFilter is a filter for resources from one particular driver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceFilter { + /// DriverName is the name used by the DRA driver kubelet plugin. + pub driver_name: Option, + + /// NamedResources describes a resource filter using the named resources model. + pub named_resources: Option, +} + +impl crate::DeepMerge for ResourceFilter { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.named_resources, other.named_resources); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceFilter { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver_name, + Key_named_resources, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driverName" => Field::Key_driver_name, + "namedResources" => Field::Key_named_resources, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceFilter; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceFilter") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_named_resources: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_named_resources => value_named_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceFilter { + driver_name: value_driver_name, + named_resources: value_named_resources, + }) + } + } + + deserializer.deserialize_struct( + "ResourceFilter", + &[ + "driverName", + "namedResources", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceFilter { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceFilter", + self.driver_name.as_ref().map_or(0, |_| 1) + + self.named_resources.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.driver_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", value)?; + } + if let Some(value) = &self.named_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namedResources", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceFilter { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceFilter".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceFilter is a filter for resources from one particular driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName is the name used by the DRA driver kubelet plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namedResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResources describes a resource filter using the named resources model.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_handle.rs b/src/v1_30/api/resource/v1alpha2/resource_handle.rs new file mode 100644 index 000000000..2d6be3241 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_handle.rs @@ -0,0 +1,179 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceHandle + +/// ResourceHandle holds opaque resource data for processing by a specific kubelet plugin. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceHandle { + /// Data contains the opaque data associated with this ResourceHandle. It is set by the controller component of the resource driver whose name matches the DriverName set in the ResourceClaimStatus this ResourceHandle is embedded in. It is set at allocation time and is intended for processing by the kubelet plugin whose name matches the DriverName set in this ResourceHandle. + /// + /// The maximum size of this field is 16KiB. This may get increased in the future, but not reduced. + pub data: Option, + + /// DriverName specifies the name of the resource driver whose kubelet plugin should be invoked to process this ResourceHandle's data once it lands on a node. This may differ from the DriverName set in ResourceClaimStatus this ResourceHandle is embedded in. + pub driver_name: Option, + + /// If StructuredData is set, then it needs to be used instead of Data. + pub structured_data: Option, +} + +impl crate::DeepMerge for ResourceHandle { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.data, other.data); + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.structured_data, other.structured_data); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceHandle { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_data, + Key_driver_name, + Key_structured_data, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "data" => Field::Key_data, + "driverName" => Field::Key_driver_name, + "structuredData" => Field::Key_structured_data, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceHandle; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceHandle") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_data: Option = None; + let mut value_driver_name: Option = None; + let mut value_structured_data: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_data => value_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_structured_data => value_structured_data = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceHandle { + data: value_data, + driver_name: value_driver_name, + structured_data: value_structured_data, + }) + } + } + + deserializer.deserialize_struct( + "ResourceHandle", + &[ + "data", + "driverName", + "structuredData", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceHandle { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceHandle", + self.data.as_ref().map_or(0, |_| 1) + + self.driver_name.as_ref().map_or(0, |_| 1) + + self.structured_data.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "data", value)?; + } + if let Some(value) = &self.driver_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", value)?; + } + if let Some(value) = &self.structured_data { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "structuredData", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceHandle { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceHandle".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "data".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Data contains the opaque data associated with this ResourceHandle. It is set by the controller component of the resource driver whose name matches the DriverName set in the ResourceClaimStatus this ResourceHandle is embedded in. It is set at allocation time and is intended for processing by the kubelet plugin whose name matches the DriverName set in this ResourceHandle.\n\nThe maximum size of this field is 16KiB. This may get increased in the future, but not reduced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName specifies the name of the resource driver whose kubelet plugin should be invoked to process this ResourceHandle's data once it lands on a node. This may differ from the DriverName set in ResourceClaimStatus this ResourceHandle is embedded in.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "structuredData".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If StructuredData is set, then it needs to be used instead of Data.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_request.rs b/src/v1_30/api/resource/v1alpha2/resource_request.rs new file mode 100644 index 000000000..5a841306a --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_request.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceRequest + +/// ResourceRequest is a request for resources from one particular driver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceRequest { + /// NamedResources describes a request for resources with the named resources model. + pub named_resources: Option, + + /// VendorParameters are arbitrary setup parameters for the requested resource. They are ignored while allocating a claim. + pub vendor_parameters: Option, +} + +impl crate::DeepMerge for ResourceRequest { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.named_resources, other.named_resources); + crate::DeepMerge::merge_from(&mut self.vendor_parameters, other.vendor_parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceRequest { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_named_resources, + Key_vendor_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "namedResources" => Field::Key_named_resources, + "vendorParameters" => Field::Key_vendor_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceRequest; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ResourceRequest") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_named_resources: Option = None; + let mut value_vendor_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_named_resources => value_named_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_parameters => value_vendor_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceRequest { + named_resources: value_named_resources, + vendor_parameters: value_vendor_parameters, + }) + } + } + + deserializer.deserialize_struct( + "ResourceRequest", + &[ + "namedResources", + "vendorParameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceRequest { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ResourceRequest", + self.named_resources.as_ref().map_or(0, |_| 1) + + self.vendor_parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.named_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namedResources", value)?; + } + if let Some(value) = &self.vendor_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorParameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceRequest { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceRequest".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceRequest is a request for resources from one particular driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "namedResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResources describes a request for resources with the named resources model.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "vendorParameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorParameters are arbitrary setup parameters for the requested resource. They are ignored while allocating a claim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/resource_slice.rs b/src/v1_30/api/resource/v1alpha2/resource_slice.rs new file mode 100644 index 000000000..39e08d58f --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/resource_slice.rs @@ -0,0 +1,270 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.ResourceSlice + +/// ResourceSlice provides information about available resources on individual nodes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ResourceSlice { + /// DriverName identifies the DRA driver providing the capacity information. A field selector can be used to list only ResourceSlice objects with a certain driver name. + pub driver_name: String, + + /// Standard object metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// NamedResources describes available resources using the named resources model. + pub named_resources: Option, + + /// NodeName identifies the node which provides the resources if they are local to a node. + /// + /// A field selector can be used to list only ResourceSlice objects with a certain node name. + pub node_name: Option, +} + +impl crate::Resource for ResourceSlice { + const API_VERSION: &'static str = "resource.k8s.io/v1alpha2"; + const GROUP: &'static str = "resource.k8s.io"; + const KIND: &'static str = "ResourceSlice"; + const VERSION: &'static str = "v1alpha2"; + const URL_PATH_SEGMENT: &'static str = "resourceslices"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for ResourceSlice { + const LIST_KIND: &'static str = "ResourceSliceList"; +} + +impl crate::Metadata for ResourceSlice { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for ResourceSlice { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.named_resources, other.named_resources); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ResourceSlice { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_driver_name, + Key_metadata, + Key_named_resources, + Key_node_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "driverName" => Field::Key_driver_name, + "metadata" => Field::Key_metadata, + "namedResources" => Field::Key_named_resources, + "nodeName" => Field::Key_node_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ResourceSlice; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_metadata: Option = None; + let mut value_named_resources: Option = None; + let mut value_node_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_named_resources => value_named_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ResourceSlice { + driver_name: value_driver_name.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + named_resources: value_named_resources, + node_name: value_node_name, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "driverName", + "metadata", + "namedResources", + "nodeName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ResourceSlice { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.named_resources.as_ref().map_or(0, |_| 1) + + self.node_name.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", &self.driver_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.named_resources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namedResources", value)?; + } + if let Some(value) = &self.node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ResourceSlice { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.ResourceSlice".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceSlice provides information about available resources on individual nodes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName identifies the DRA driver providing the capacity information. A field selector can be used to list only ResourceSlice objects with a certain driver name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "namedResources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NamedResources describes available resources using the named resources model.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeName identifies the node which provides the resources if they are local to a node.\n\nA field selector can be used to list only ResourceSlice objects with a certain node name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "driverName".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/structured_resource_handle.rs b/src/v1_30/api/resource/v1alpha2/structured_resource_handle.rs new file mode 100644 index 000000000..5d7265ee4 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/structured_resource_handle.rs @@ -0,0 +1,207 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.StructuredResourceHandle + +/// StructuredResourceHandle is the in-tree representation of the allocation result. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StructuredResourceHandle { + /// NodeName is the name of the node providing the necessary resources if the resources are local to a node. + pub node_name: Option, + + /// Results lists all allocated driver resources. + pub results: Vec, + + /// VendorClaimParameters are the per-claim configuration parameters from the resource claim parameters at the time that the claim was allocated. + pub vendor_claim_parameters: Option, + + /// VendorClassParameters are the per-claim configuration parameters from the resource class at the time that the claim was allocated. + pub vendor_class_parameters: Option, +} + +impl crate::DeepMerge for StructuredResourceHandle { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::merge_strategies::list::atomic(&mut self.results, other.results); + crate::DeepMerge::merge_from(&mut self.vendor_claim_parameters, other.vendor_claim_parameters); + crate::DeepMerge::merge_from(&mut self.vendor_class_parameters, other.vendor_class_parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StructuredResourceHandle { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_node_name, + Key_results, + Key_vendor_claim_parameters, + Key_vendor_class_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "nodeName" => Field::Key_node_name, + "results" => Field::Key_results, + "vendorClaimParameters" => Field::Key_vendor_claim_parameters, + "vendorClassParameters" => Field::Key_vendor_class_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StructuredResourceHandle; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StructuredResourceHandle") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_node_name: Option = None; + let mut value_results: Option> = None; + let mut value_vendor_claim_parameters: Option = None; + let mut value_vendor_class_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_results => value_results = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_claim_parameters => value_vendor_claim_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_vendor_class_parameters => value_vendor_class_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StructuredResourceHandle { + node_name: value_node_name, + results: value_results.unwrap_or_default(), + vendor_claim_parameters: value_vendor_claim_parameters, + vendor_class_parameters: value_vendor_class_parameters, + }) + } + } + + deserializer.deserialize_struct( + "StructuredResourceHandle", + &[ + "nodeName", + "results", + "vendorClaimParameters", + "vendorClassParameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StructuredResourceHandle { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StructuredResourceHandle", + 1 + + self.node_name.as_ref().map_or(0, |_| 1) + + self.vendor_claim_parameters.as_ref().map_or(0, |_| 1) + + self.vendor_class_parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.node_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "results", &self.results)?; + if let Some(value) = &self.vendor_claim_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorClaimParameters", value)?; + } + if let Some(value) = &self.vendor_class_parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vendorClassParameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StructuredResourceHandle { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.StructuredResourceHandle".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StructuredResourceHandle is the in-tree representation of the allocation result.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("NodeName is the name of the node providing the necessary resources if the resources are local to a node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "results".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Results lists all allocated driver resources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "vendorClaimParameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorClaimParameters are the per-claim configuration parameters from the resource claim parameters at the time that the claim was allocated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "vendorClassParameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorClassParameters are the per-claim configuration parameters from the resource class at the time that the claim was allocated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "results".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/resource/v1alpha2/vendor_parameters.rs b/src/v1_30/api/resource/v1alpha2/vendor_parameters.rs new file mode 100644 index 000000000..2bb8161c0 --- /dev/null +++ b/src/v1_30/api/resource/v1alpha2/vendor_parameters.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.resource.v1alpha2.VendorParameters + +/// VendorParameters are opaque parameters for one particular driver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VendorParameters { + /// DriverName is the name used by the DRA driver kubelet plugin. + pub driver_name: Option, + + /// Parameters can be arbitrary setup parameters. They are ignored while allocating a claim. + pub parameters: Option, +} + +impl crate::DeepMerge for VendorParameters { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.parameters, other.parameters); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VendorParameters { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_driver_name, + Key_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "driverName" => Field::Key_driver_name, + "parameters" => Field::Key_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VendorParameters; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VendorParameters") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_parameters: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters => value_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VendorParameters { + driver_name: value_driver_name, + parameters: value_parameters, + }) + } + } + + deserializer.deserialize_struct( + "VendorParameters", + &[ + "driverName", + "parameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VendorParameters { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VendorParameters", + self.driver_name.as_ref().map_or(0, |_| 1) + + self.parameters.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.driver_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", value)?; + } + if let Some(value) = &self.parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VendorParameters { + fn schema_name() -> String { + "io.k8s.api.resource.v1alpha2.VendorParameters".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VendorParameters are opaque parameters for one particular driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DriverName is the name used by the DRA driver kubelet plugin.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "parameters".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Parameters can be arbitrary setup parameters. They are ignored while allocating a claim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/scheduling/mod.rs b/src/v1_30/api/scheduling/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/api/scheduling/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/api/scheduling/v1/mod.rs b/src/v1_30/api/scheduling/v1/mod.rs new file mode 100644 index 000000000..30113f1bc --- /dev/null +++ b/src/v1_30/api/scheduling/v1/mod.rs @@ -0,0 +1,3 @@ + +mod priority_class; +pub use self::priority_class::PriorityClass; diff --git a/src/v1_30/api/scheduling/v1/priority_class.rs b/src/v1_30/api/scheduling/v1/priority_class.rs new file mode 100644 index 000000000..584572de1 --- /dev/null +++ b/src/v1_30/api/scheduling/v1/priority_class.rs @@ -0,0 +1,294 @@ +// Generated from definition io.k8s.api.scheduling.v1.PriorityClass + +/// PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct PriorityClass { + /// description is an arbitrary string that usually provides guidelines on when this priority class should be used. + pub description: Option, + + /// globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority. + pub global_default: Option, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. + pub preemption_policy: Option, + + /// value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec. + pub value: i32, +} + +impl crate::Resource for PriorityClass { + const API_VERSION: &'static str = "scheduling.k8s.io/v1"; + const GROUP: &'static str = "scheduling.k8s.io"; + const KIND: &'static str = "PriorityClass"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "priorityclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for PriorityClass { + const LIST_KIND: &'static str = "PriorityClassList"; +} + +impl crate::Metadata for PriorityClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for PriorityClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.description, other.description); + crate::DeepMerge::merge_from(&mut self.global_default, other.global_default); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.preemption_policy, other.preemption_policy); + crate::DeepMerge::merge_from(&mut self.value, other.value); + } +} + +impl<'de> crate::serde::Deserialize<'de> for PriorityClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_description, + Key_global_default, + Key_metadata, + Key_preemption_policy, + Key_value, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "description" => Field::Key_description, + "globalDefault" => Field::Key_global_default, + "metadata" => Field::Key_metadata, + "preemptionPolicy" => Field::Key_preemption_policy, + "value" => Field::Key_value, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = PriorityClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_description: Option = None; + let mut value_global_default: Option = None; + let mut value_metadata: Option = None; + let mut value_preemption_policy: Option = None; + let mut value_value: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_description => value_description = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_global_default => value_global_default = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_preemption_policy => value_preemption_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_value => value_value = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(PriorityClass { + description: value_description, + global_default: value_global_default, + metadata: value_metadata.unwrap_or_default(), + preemption_policy: value_preemption_policy, + value: value_value.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "description", + "globalDefault", + "metadata", + "preemptionPolicy", + "value", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for PriorityClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.description.as_ref().map_or(0, |_| 1) + + self.global_default.as_ref().map_or(0, |_| 1) + + self.preemption_policy.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.description { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "description", value)?; + } + if let Some(value) = &self.global_default { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "globalDefault", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.preemption_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preemptionPolicy", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "value", &self.value)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for PriorityClass { + fn schema_name() -> String { + "io.k8s.api.scheduling.v1.PriorityClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "description".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("description is an arbitrary string that usually provides guidelines on when this priority class should be used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "globalDefault".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "preemptionPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "value".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "value".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/mod.rs b/src/v1_30/api/storage/mod.rs new file mode 100644 index 000000000..eddcfcf9e --- /dev/null +++ b/src/v1_30/api/storage/mod.rs @@ -0,0 +1,3 @@ +pub mod v1; + +pub mod v1alpha1; diff --git a/src/v1_30/api/storage/v1/csi_driver.rs b/src/v1_30/api/storage/v1/csi_driver.rs new file mode 100644 index 000000000..3f9d33cd8 --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_driver.rs @@ -0,0 +1,218 @@ +// Generated from definition io.k8s.api.storage.v1.CSIDriver + +/// CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSIDriver { + /// Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character (\[a-z0-9A-Z\]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec represents the specification of the CSI Driver. + pub spec: crate::api::storage::v1::CSIDriverSpec, +} + +impl crate::Resource for CSIDriver { + const API_VERSION: &'static str = "storage.k8s.io/v1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "CSIDriver"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "csidrivers"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for CSIDriver { + const LIST_KIND: &'static str = "CSIDriverList"; +} + +impl crate::Metadata for CSIDriver { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CSIDriver { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSIDriver { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSIDriver; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSIDriver { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSIDriver { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSIDriver { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSIDriver".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec represents the specification of the CSI Driver.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/csi_driver_spec.rs b/src/v1_30/api/storage/v1/csi_driver_spec.rs new file mode 100644 index 000000000..891bd7be4 --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_driver_spec.rs @@ -0,0 +1,358 @@ +// Generated from definition io.k8s.api.storage.v1.CSIDriverSpec + +/// CSIDriverSpec is the specification of a CSIDriver. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSIDriverSpec { + /// attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called. + /// + /// This field is immutable. + pub attach_required: Option, + + /// fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. + /// + /// This field was immutable in Kubernetes \< 1.29 and now is mutable. + /// + /// Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce. + pub fs_group_policy: Option, + + /// podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false. + /// + /// The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. + /// + /// The following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. "csi.storage.k8s.io/pod.name": pod.Name "csi.storage.k8s.io/pod.namespace": pod.Namespace "csi.storage.k8s.io/pod.uid": string(pod.UID) "csi.storage.k8s.io/ephemeral": "true" if the volume is an ephemeral inline volume + /// defined by a CSIVolumeSource, otherwise "false" + /// + /// "csi.storage.k8s.io/ephemeral" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the "Persistent" and "Ephemeral" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver. + /// + /// This field was immutable in Kubernetes \< 1.29 and now is mutable. + pub pod_info_on_mount: Option, + + /// requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false. + /// + /// Note: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container. + pub requires_republish: Option, + + /// seLinuxMount specifies if the CSI driver supports "-o context" mount option. + /// + /// When "true", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with "-o context=xyz" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context. + /// + /// When "false", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem. + /// + /// Default is "false". + pub se_linux_mount: Option, + + /// storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true. + /// + /// The check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object. + /// + /// Alternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published. + /// + /// This field was immutable in Kubernetes \<= 1.22 and now is mutable. + pub storage_capacity: Option, + + /// tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: "csi.storage.k8s.io/serviceAccount.tokens": { + /// "\": { + /// "token": \, + /// "expirationTimestamp": \, + /// }, + /// ... + /// } + /// + /// Note: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically. + pub token_requests: Option>, + + /// volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is "Persistent", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. + /// + /// The other mode is "Ephemeral". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. + /// + /// For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. + /// + /// This field is beta. This field is immutable. + pub volume_lifecycle_modes: Option>, +} + +impl crate::DeepMerge for CSIDriverSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.attach_required, other.attach_required); + crate::DeepMerge::merge_from(&mut self.fs_group_policy, other.fs_group_policy); + crate::DeepMerge::merge_from(&mut self.pod_info_on_mount, other.pod_info_on_mount); + crate::DeepMerge::merge_from(&mut self.requires_republish, other.requires_republish); + crate::DeepMerge::merge_from(&mut self.se_linux_mount, other.se_linux_mount); + crate::DeepMerge::merge_from(&mut self.storage_capacity, other.storage_capacity); + crate::merge_strategies::list::atomic(&mut self.token_requests, other.token_requests); + crate::merge_strategies::list::set(&mut self.volume_lifecycle_modes, other.volume_lifecycle_modes); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSIDriverSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_attach_required, + Key_fs_group_policy, + Key_pod_info_on_mount, + Key_requires_republish, + Key_se_linux_mount, + Key_storage_capacity, + Key_token_requests, + Key_volume_lifecycle_modes, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "attachRequired" => Field::Key_attach_required, + "fsGroupPolicy" => Field::Key_fs_group_policy, + "podInfoOnMount" => Field::Key_pod_info_on_mount, + "requiresRepublish" => Field::Key_requires_republish, + "seLinuxMount" => Field::Key_se_linux_mount, + "storageCapacity" => Field::Key_storage_capacity, + "tokenRequests" => Field::Key_token_requests, + "volumeLifecycleModes" => Field::Key_volume_lifecycle_modes, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSIDriverSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CSIDriverSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_attach_required: Option = None; + let mut value_fs_group_policy: Option = None; + let mut value_pod_info_on_mount: Option = None; + let mut value_requires_republish: Option = None; + let mut value_se_linux_mount: Option = None; + let mut value_storage_capacity: Option = None; + let mut value_token_requests: Option> = None; + let mut value_volume_lifecycle_modes: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_attach_required => value_attach_required = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fs_group_policy => value_fs_group_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pod_info_on_mount => value_pod_info_on_mount = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_requires_republish => value_requires_republish = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_se_linux_mount => value_se_linux_mount = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_capacity => value_storage_capacity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_token_requests => value_token_requests = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_lifecycle_modes => value_volume_lifecycle_modes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSIDriverSpec { + attach_required: value_attach_required, + fs_group_policy: value_fs_group_policy, + pod_info_on_mount: value_pod_info_on_mount, + requires_republish: value_requires_republish, + se_linux_mount: value_se_linux_mount, + storage_capacity: value_storage_capacity, + token_requests: value_token_requests, + volume_lifecycle_modes: value_volume_lifecycle_modes, + }) + } + } + + deserializer.deserialize_struct( + "CSIDriverSpec", + &[ + "attachRequired", + "fsGroupPolicy", + "podInfoOnMount", + "requiresRepublish", + "seLinuxMount", + "storageCapacity", + "tokenRequests", + "volumeLifecycleModes", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSIDriverSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CSIDriverSpec", + self.attach_required.as_ref().map_or(0, |_| 1) + + self.fs_group_policy.as_ref().map_or(0, |_| 1) + + self.pod_info_on_mount.as_ref().map_or(0, |_| 1) + + self.requires_republish.as_ref().map_or(0, |_| 1) + + self.se_linux_mount.as_ref().map_or(0, |_| 1) + + self.storage_capacity.as_ref().map_or(0, |_| 1) + + self.token_requests.as_ref().map_or(0, |_| 1) + + self.volume_lifecycle_modes.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.attach_required { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attachRequired", value)?; + } + if let Some(value) = &self.fs_group_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsGroupPolicy", value)?; + } + if let Some(value) = &self.pod_info_on_mount { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podInfoOnMount", value)?; + } + if let Some(value) = &self.requires_republish { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requiresRepublish", value)?; + } + if let Some(value) = &self.se_linux_mount { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seLinuxMount", value)?; + } + if let Some(value) = &self.storage_capacity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageCapacity", value)?; + } + if let Some(value) = &self.token_requests { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tokenRequests", value)?; + } + if let Some(value) = &self.volume_lifecycle_modes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeLifecycleModes", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSIDriverSpec { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSIDriverSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSIDriverSpec is the specification of a CSIDriver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "attachRequired".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.\n\nThis field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "fsGroupPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "podInfoOnMount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false.\n\nThe CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext.\n\nThe following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume\n defined by a CSIVolumeSource, otherwise \"false\"\n\n\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "requiresRepublish".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "seLinuxMount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "storageCapacity".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field was immutable in Kubernetes <= 1.22 and now is mutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "tokenRequests".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"\": {\n \"token\": ,\n \"expirationTimestamp\": ,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "volumeLifecycleModes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism.\n\nThe other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume.\n\nFor more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.\n\nThis field is beta. This field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/csi_node.rs b/src/v1_30/api/storage/v1/csi_node.rs new file mode 100644 index 000000000..c55f473b6 --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_node.rs @@ -0,0 +1,218 @@ +// Generated from definition io.k8s.api.storage.v1.CSINode + +/// CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSINode { + /// Standard object's metadata. metadata.name must be the Kubernetes node name. + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec is the specification of CSINode + pub spec: crate::api::storage::v1::CSINodeSpec, +} + +impl crate::Resource for CSINode { + const API_VERSION: &'static str = "storage.k8s.io/v1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "CSINode"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "csinodes"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for CSINode { + const LIST_KIND: &'static str = "CSINodeList"; +} + +impl crate::Metadata for CSINode { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CSINode { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSINode { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSINode; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSINode { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSINode { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSINode { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSINode".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. metadata.name must be the Kubernetes node name.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec is the specification of CSINode".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/csi_node_driver.rs b/src/v1_30/api/storage/v1/csi_node_driver.rs new file mode 100644 index 000000000..dac060eb9 --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_node_driver.rs @@ -0,0 +1,210 @@ +// Generated from definition io.k8s.api.storage.v1.CSINodeDriver + +/// CSINodeDriver holds information about the specification of one CSI driver installed on a node +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSINodeDriver { + /// allocatable represents the volume resources of a node that are available for scheduling. This field is beta. + pub allocatable: Option, + + /// name represents the name of the CSI driver that this object refers to. This MUST be the same name returned by the CSI GetPluginName() call for that driver. + pub name: String, + + /// nodeID of the node from the driver point of view. This field enables Kubernetes to communicate with storage systems that do not share the same nomenclature for nodes. For example, Kubernetes may refer to a given node as "node1", but the storage system may refer to the same node as "nodeA". When Kubernetes issues a command to the storage system to attach a volume to a specific node, it can use this field to refer to the node name using the ID that the storage system will understand, e.g. "nodeA" instead of "node1". This field is required. + pub node_id: String, + + /// topologyKeys is the list of keys supported by the driver. When a driver is initialized on a cluster, it provides a set of topology keys that it understands (e.g. "company.com/zone", "company.com/region"). When a driver is initialized on a node, it provides the same topology keys along with values. Kubelet will expose these topology keys as labels on its own node object. When Kubernetes does topology aware provisioning, it can use this list to determine which labels it should retrieve from the node object and pass back to the driver. It is possible for different nodes to use different topology keys. This can be empty if driver does not support topology. + pub topology_keys: Option>, +} + +impl crate::DeepMerge for CSINodeDriver { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allocatable, other.allocatable); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.node_id, other.node_id); + crate::merge_strategies::list::atomic(&mut self.topology_keys, other.topology_keys); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSINodeDriver { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_allocatable, + Key_name, + Key_node_id, + Key_topology_keys, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "allocatable" => Field::Key_allocatable, + "name" => Field::Key_name, + "nodeID" => Field::Key_node_id, + "topologyKeys" => Field::Key_topology_keys, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSINodeDriver; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CSINodeDriver") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allocatable: Option = None; + let mut value_name: Option = None; + let mut value_node_id: Option = None; + let mut value_topology_keys: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_allocatable => value_allocatable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_id => value_node_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_topology_keys => value_topology_keys = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSINodeDriver { + allocatable: value_allocatable, + name: value_name.unwrap_or_default(), + node_id: value_node_id.unwrap_or_default(), + topology_keys: value_topology_keys, + }) + } + } + + deserializer.deserialize_struct( + "CSINodeDriver", + &[ + "allocatable", + "name", + "nodeID", + "topologyKeys", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSINodeDriver { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CSINodeDriver", + 2 + + self.allocatable.as_ref().map_or(0, |_| 1) + + self.topology_keys.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.allocatable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allocatable", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeID", &self.node_id)?; + if let Some(value) = &self.topology_keys { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "topologyKeys", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSINodeDriver { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSINodeDriver".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSINodeDriver holds information about the specification of one CSI driver installed on a node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allocatable".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allocatable represents the volume resources of a node that are available for scheduling. This field is beta.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name represents the name of the CSI driver that this object refers to. This MUST be the same name returned by the CSI GetPluginName() call for that driver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeID".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeID of the node from the driver point of view. This field enables Kubernetes to communicate with storage systems that do not share the same nomenclature for nodes. For example, Kubernetes may refer to a given node as \"node1\", but the storage system may refer to the same node as \"nodeA\". When Kubernetes issues a command to the storage system to attach a volume to a specific node, it can use this field to refer to the node name using the ID that the storage system will understand, e.g. \"nodeA\" instead of \"node1\". This field is required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "topologyKeys".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("topologyKeys is the list of keys supported by the driver. When a driver is initialized on a cluster, it provides a set of topology keys that it understands (e.g. \"company.com/zone\", \"company.com/region\"). When a driver is initialized on a node, it provides the same topology keys along with values. Kubelet will expose these topology keys as labels on its own node object. When Kubernetes does topology aware provisioning, it can use this list to determine which labels it should retrieve from the node object and pass back to the driver. It is possible for different nodes to use different topology keys. This can be empty if driver does not support topology.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "nodeID".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/csi_node_spec.rs b/src/v1_30/api/storage/v1/csi_node_spec.rs new file mode 100644 index 000000000..4717576df --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_node_spec.rs @@ -0,0 +1,139 @@ +// Generated from definition io.k8s.api.storage.v1.CSINodeSpec + +/// CSINodeSpec holds information about the specification of all CSI drivers installed on a node +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSINodeSpec { + /// drivers is a list of information of all CSI Drivers existing on a node. If all drivers in the list are uninstalled, this can become empty. + pub drivers: Vec, +} + +impl crate::DeepMerge for CSINodeSpec { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.drivers, + other.drivers, + &[|lhs, rhs| lhs.name == rhs.name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSINodeSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_drivers, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "drivers" => Field::Key_drivers, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSINodeSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CSINodeSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_drivers: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_drivers => value_drivers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSINodeSpec { + drivers: value_drivers.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CSINodeSpec", + &[ + "drivers", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSINodeSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CSINodeSpec", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "drivers", &self.drivers)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSINodeSpec { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSINodeSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSINodeSpec holds information about the specification of all CSI drivers installed on a node".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "drivers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("drivers is a list of information of all CSI Drivers existing on a node. If all drivers in the list are uninstalled, this can become empty.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "drivers".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/csi_storage_capacity.rs b/src/v1_30/api/storage/v1/csi_storage_capacity.rs new file mode 100644 index 000000000..94e6e2b2c --- /dev/null +++ b/src/v1_30/api/storage/v1/csi_storage_capacity.rs @@ -0,0 +1,309 @@ +// Generated from definition io.k8s.api.storage.v1.CSIStorageCapacity + +/// CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes. +/// +/// For example this can express things like: - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1" - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123" +/// +/// The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero +/// +/// The producer of these objects can decide which approach is more suitable. +/// +/// They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CSIStorageCapacity { + /// capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + /// + /// The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable. + pub capacity: Option, + + /// maximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields. + /// + /// This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim. + pub maximum_volume_size: Option, + + /// Standard object's metadata. The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-\, a generated name, or a reverse-domain name which ends with the unique CSI driver name. + /// + /// Objects are namespaced. + /// + /// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable. + pub node_topology: Option, + + /// storageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable. + pub storage_class_name: String, +} + +impl crate::Resource for CSIStorageCapacity { + const API_VERSION: &'static str = "storage.k8s.io/v1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "CSIStorageCapacity"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "csistoragecapacities"; + type Scope = crate::NamespaceResourceScope; +} + +impl crate::ListableResource for CSIStorageCapacity { + const LIST_KIND: &'static str = "CSIStorageCapacityList"; +} + +impl crate::Metadata for CSIStorageCapacity { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CSIStorageCapacity { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.capacity, other.capacity); + crate::DeepMerge::merge_from(&mut self.maximum_volume_size, other.maximum_volume_size); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.node_topology, other.node_topology); + crate::DeepMerge::merge_from(&mut self.storage_class_name, other.storage_class_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CSIStorageCapacity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_capacity, + Key_maximum_volume_size, + Key_metadata, + Key_node_topology, + Key_storage_class_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "capacity" => Field::Key_capacity, + "maximumVolumeSize" => Field::Key_maximum_volume_size, + "metadata" => Field::Key_metadata, + "nodeTopology" => Field::Key_node_topology, + "storageClassName" => Field::Key_storage_class_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CSIStorageCapacity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_capacity: Option = None; + let mut value_maximum_volume_size: Option = None; + let mut value_metadata: Option = None; + let mut value_node_topology: Option = None; + let mut value_storage_class_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_maximum_volume_size => value_maximum_volume_size = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_topology => value_node_topology = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_class_name => value_storage_class_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CSIStorageCapacity { + capacity: value_capacity, + maximum_volume_size: value_maximum_volume_size, + metadata: value_metadata.unwrap_or_default(), + node_topology: value_node_topology, + storage_class_name: value_storage_class_name.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "capacity", + "maximumVolumeSize", + "metadata", + "nodeTopology", + "storageClassName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CSIStorageCapacity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.capacity.as_ref().map_or(0, |_| 1) + + self.maximum_volume_size.as_ref().map_or(0, |_| 1) + + self.node_topology.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.capacity { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?; + } + if let Some(value) = &self.maximum_volume_size { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maximumVolumeSize", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.node_topology { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeTopology", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageClassName", &self.storage_class_name)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CSIStorageCapacity { + fn schema_name() -> String { + "io.k8s.api.storage.v1.CSIStorageCapacity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes.\n\nFor example this can express things like: - StorageClass \"standard\" has \"1234 GiB\" available in \"topology.kubernetes.io/zone=us-east1\" - StorageClass \"localssd\" has \"10 GiB\" available in \"kubernetes.io/hostname=knode-abc123\"\n\nThe following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zero\n\nThe producer of these objects can decide which approach is more suitable.\n\nThey are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "capacity".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.\n\nThe semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "maximumVolumeSize".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("maximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.\n\nThis is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-, a generated name, or a reverse-domain name which ends with the unique CSI driver name.\n\nObjects are namespaced.\n\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "nodeTopology".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "storageClassName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "storageClassName".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/mod.rs b/src/v1_30/api/storage/v1/mod.rs new file mode 100644 index 000000000..f0961497d --- /dev/null +++ b/src/v1_30/api/storage/v1/mod.rs @@ -0,0 +1,42 @@ + +mod csi_driver; +pub use self::csi_driver::CSIDriver; + +mod csi_driver_spec; +pub use self::csi_driver_spec::CSIDriverSpec; + +mod csi_node; +pub use self::csi_node::CSINode; + +mod csi_node_driver; +pub use self::csi_node_driver::CSINodeDriver; + +mod csi_node_spec; +pub use self::csi_node_spec::CSINodeSpec; + +mod csi_storage_capacity; +pub use self::csi_storage_capacity::CSIStorageCapacity; + +mod storage_class; +pub use self::storage_class::StorageClass; + +mod token_request; +pub use self::token_request::TokenRequest; + +mod volume_attachment; +pub use self::volume_attachment::VolumeAttachment; + +mod volume_attachment_source; +pub use self::volume_attachment_source::VolumeAttachmentSource; + +mod volume_attachment_spec; +pub use self::volume_attachment_spec::VolumeAttachmentSpec; + +mod volume_attachment_status; +pub use self::volume_attachment_status::VolumeAttachmentStatus; + +mod volume_error; +pub use self::volume_error::VolumeError; + +mod volume_node_resources; +pub use self::volume_node_resources::VolumeNodeResources; diff --git a/src/v1_30/api/storage/v1/storage_class.rs b/src/v1_30/api/storage/v1/storage_class.rs new file mode 100644 index 000000000..5782053f9 --- /dev/null +++ b/src/v1_30/api/storage/v1/storage_class.rs @@ -0,0 +1,394 @@ +// Generated from definition io.k8s.api.storage.v1.StorageClass + +/// StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned. +/// +/// StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageClass { + /// allowVolumeExpansion shows whether the storage class allow volume expand. + pub allow_volume_expansion: Option, + + /// allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. Each volume plugin defines its own supported topology specifications. An empty TopologySelectorTerm list means there is no topology restriction. This field is only honored by servers that enable the VolumeScheduling feature. + pub allowed_topologies: Option>, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. e.g. \["ro", "soft"\]. Not validated - mount of the PVs will simply fail if one is invalid. + pub mount_options: Option>, + + /// parameters holds the parameters for the provisioner that should create volumes of this storage class. + pub parameters: Option>, + + /// provisioner indicates the type of the provisioner. + pub provisioner: String, + + /// reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. Defaults to Delete. + pub reclaim_policy: Option, + + /// volumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is only honored by servers that enable the VolumeScheduling feature. + pub volume_binding_mode: Option, +} + +impl crate::Resource for StorageClass { + const API_VERSION: &'static str = "storage.k8s.io/v1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "StorageClass"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "storageclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for StorageClass { + const LIST_KIND: &'static str = "StorageClassList"; +} + +impl crate::Metadata for StorageClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for StorageClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.allow_volume_expansion, other.allow_volume_expansion); + crate::merge_strategies::list::atomic(&mut self.allowed_topologies, other.allowed_topologies); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::list::atomic(&mut self.mount_options, other.mount_options); + crate::merge_strategies::map::granular(&mut self.parameters, other.parameters, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.provisioner, other.provisioner); + crate::DeepMerge::merge_from(&mut self.reclaim_policy, other.reclaim_policy); + crate::DeepMerge::merge_from(&mut self.volume_binding_mode, other.volume_binding_mode); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_allow_volume_expansion, + Key_allowed_topologies, + Key_metadata, + Key_mount_options, + Key_parameters, + Key_provisioner, + Key_reclaim_policy, + Key_volume_binding_mode, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "allowVolumeExpansion" => Field::Key_allow_volume_expansion, + "allowedTopologies" => Field::Key_allowed_topologies, + "metadata" => Field::Key_metadata, + "mountOptions" => Field::Key_mount_options, + "parameters" => Field::Key_parameters, + "provisioner" => Field::Key_provisioner, + "reclaimPolicy" => Field::Key_reclaim_policy, + "volumeBindingMode" => Field::Key_volume_binding_mode, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_allow_volume_expansion: Option = None; + let mut value_allowed_topologies: Option> = None; + let mut value_metadata: Option = None; + let mut value_mount_options: Option> = None; + let mut value_parameters: Option> = None; + let mut value_provisioner: Option = None; + let mut value_reclaim_policy: Option = None; + let mut value_volume_binding_mode: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_allow_volume_expansion => value_allow_volume_expansion = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_allowed_topologies => value_allowed_topologies = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_mount_options => value_mount_options = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters => value_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_provisioner => value_provisioner = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reclaim_policy => value_reclaim_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_volume_binding_mode => value_volume_binding_mode = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageClass { + allow_volume_expansion: value_allow_volume_expansion, + allowed_topologies: value_allowed_topologies, + metadata: value_metadata.unwrap_or_default(), + mount_options: value_mount_options, + parameters: value_parameters, + provisioner: value_provisioner.unwrap_or_default(), + reclaim_policy: value_reclaim_policy, + volume_binding_mode: value_volume_binding_mode, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "allowVolumeExpansion", + "allowedTopologies", + "metadata", + "mountOptions", + "parameters", + "provisioner", + "reclaimPolicy", + "volumeBindingMode", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.allow_volume_expansion.as_ref().map_or(0, |_| 1) + + self.allowed_topologies.as_ref().map_or(0, |_| 1) + + self.mount_options.as_ref().map_or(0, |_| 1) + + self.parameters.as_ref().map_or(0, |_| 1) + + self.reclaim_policy.as_ref().map_or(0, |_| 1) + + self.volume_binding_mode.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.allow_volume_expansion { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowVolumeExpansion", value)?; + } + if let Some(value) = &self.allowed_topologies { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allowedTopologies", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.mount_options { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountOptions", value)?; + } + if let Some(value) = &self.parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameters", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "provisioner", &self.provisioner)?; + if let Some(value) = &self.reclaim_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reclaimPolicy", value)?; + } + if let Some(value) = &self.volume_binding_mode { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeBindingMode", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageClass { + fn schema_name() -> String { + "io.k8s.api.storage.v1.StorageClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "allowVolumeExpansion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allowVolumeExpansion shows whether the storage class allow volume expand.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "allowedTopologies".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. Each volume plugin defines its own supported topology specifications. An empty TopologySelectorTerm list means there is no topology restriction. This field is only honored by servers that enable the VolumeScheduling feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "mountOptions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. e.g. [\"ro\", \"soft\"]. Not validated - mount of the PVs will simply fail if one is invalid.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "parameters".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("parameters holds the parameters for the provisioner that should create volumes of this storage class.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "provisioner".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("provisioner indicates the type of the provisioner.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reclaimPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. Defaults to Delete.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "volumeBindingMode".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("volumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is only honored by servers that enable the VolumeScheduling feature.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + "provisioner".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/token_request.rs b/src/v1_30/api/storage/v1/token_request.rs new file mode 100644 index 000000000..60b37c3e9 --- /dev/null +++ b/src/v1_30/api/storage/v1/token_request.rs @@ -0,0 +1,154 @@ +// Generated from definition io.k8s.api.storage.v1.TokenRequest + +/// TokenRequest contains parameters of a service account token. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TokenRequest { + /// audience is the intended audience of the token in "TokenRequestSpec". It will default to the audiences of kube apiserver. + pub audience: String, + + /// expirationSeconds is the duration of validity of the token in "TokenRequestSpec". It has the same default value of "ExpirationSeconds" in "TokenRequestSpec". + pub expiration_seconds: Option, +} + +impl crate::DeepMerge for TokenRequest { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.audience, other.audience); + crate::DeepMerge::merge_from(&mut self.expiration_seconds, other.expiration_seconds); + } +} + +impl<'de> crate::serde::Deserialize<'de> for TokenRequest { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_audience, + Key_expiration_seconds, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "audience" => Field::Key_audience, + "expirationSeconds" => Field::Key_expiration_seconds, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = TokenRequest; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("TokenRequest") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_audience: Option = None; + let mut value_expiration_seconds: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_audience => value_audience = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_expiration_seconds => value_expiration_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(TokenRequest { + audience: value_audience.unwrap_or_default(), + expiration_seconds: value_expiration_seconds, + }) + } + } + + deserializer.deserialize_struct( + "TokenRequest", + &[ + "audience", + "expirationSeconds", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for TokenRequest { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "TokenRequest", + 1 + + self.expiration_seconds.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "audience", &self.audience)?; + if let Some(value) = &self.expiration_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "expirationSeconds", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for TokenRequest { + fn schema_name() -> String { + "io.k8s.api.storage.v1.TokenRequest".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("TokenRequest contains parameters of a service account token.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "audience".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("audience is the intended audience of the token in \"TokenRequestSpec\". It will default to the audiences of kube apiserver.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "expirationSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("expirationSeconds is the duration of validity of the token in \"TokenRequestSpec\". It has the same default value of \"ExpirationSeconds\" in \"TokenRequestSpec\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "audience".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_attachment.rs b/src/v1_30/api/storage/v1/volume_attachment.rs new file mode 100644 index 000000000..4fae0f2f2 --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_attachment.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeAttachment + +/// VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node. +/// +/// VolumeAttachment objects are non-namespaced. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeAttachment { + /// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system. + pub spec: crate::api::storage::v1::VolumeAttachmentSpec, + + /// status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher. + pub status: Option, +} + +impl crate::Resource for VolumeAttachment { + const API_VERSION: &'static str = "storage.k8s.io/v1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "VolumeAttachment"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "volumeattachments"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for VolumeAttachment { + const LIST_KIND: &'static str = "VolumeAttachmentList"; +} + +impl crate::Metadata for VolumeAttachment { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for VolumeAttachment { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeAttachment { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeAttachment; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeAttachment { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeAttachment { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeAttachment { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeAttachment".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.\n\nVolumeAttachment objects are non-namespaced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_attachment_source.rs b/src/v1_30/api/storage/v1/volume_attachment_source.rs new file mode 100644 index 000000000..04b914bbe --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_attachment_source.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeAttachmentSource + +/// VolumeAttachmentSource represents a volume that should be attached. Right now only PersistenVolumes can be attached via external attacher, in future we may allow also inline volumes in pods. Exactly one member can be set. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeAttachmentSource { + /// inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature. + pub inline_volume_spec: Option, + + /// persistentVolumeName represents the name of the persistent volume to attach. + pub persistent_volume_name: Option, +} + +impl crate::DeepMerge for VolumeAttachmentSource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.inline_volume_spec, other.inline_volume_spec); + crate::DeepMerge::merge_from(&mut self.persistent_volume_name, other.persistent_volume_name); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeAttachmentSource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_inline_volume_spec, + Key_persistent_volume_name, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "inlineVolumeSpec" => Field::Key_inline_volume_spec, + "persistentVolumeName" => Field::Key_persistent_volume_name, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeAttachmentSource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeAttachmentSource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_inline_volume_spec: Option = None; + let mut value_persistent_volume_name: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_inline_volume_spec => value_inline_volume_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_persistent_volume_name => value_persistent_volume_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeAttachmentSource { + inline_volume_spec: value_inline_volume_spec, + persistent_volume_name: value_persistent_volume_name, + }) + } + } + + deserializer.deserialize_struct( + "VolumeAttachmentSource", + &[ + "inlineVolumeSpec", + "persistentVolumeName", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeAttachmentSource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeAttachmentSource", + self.inline_volume_spec.as_ref().map_or(0, |_| 1) + + self.persistent_volume_name.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.inline_volume_spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "inlineVolumeSpec", value)?; + } + if let Some(value) = &self.persistent_volume_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeName", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeAttachmentSource { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeAttachmentSource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeAttachmentSource represents a volume that should be attached. Right now only PersistenVolumes can be attached via external attacher, in future we may allow also inline volumes in pods. Exactly one member can be set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "inlineVolumeSpec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "persistentVolumeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("persistentVolumeName represents the name of the persistent volume to attach.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_attachment_spec.rs b/src/v1_30/api/storage/v1/volume_attachment_spec.rs new file mode 100644 index 000000000..02b0d7d0e --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_attachment_spec.rs @@ -0,0 +1,174 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeAttachmentSpec + +/// VolumeAttachmentSpec is the specification of a VolumeAttachment request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeAttachmentSpec { + /// attacher indicates the name of the volume driver that MUST handle this request. This is the name returned by GetPluginName(). + pub attacher: String, + + /// nodeName represents the node that the volume should be attached to. + pub node_name: String, + + /// source represents the volume that should be attached. + pub source: crate::api::storage::v1::VolumeAttachmentSource, +} + +impl crate::DeepMerge for VolumeAttachmentSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.attacher, other.attacher); + crate::DeepMerge::merge_from(&mut self.node_name, other.node_name); + crate::DeepMerge::merge_from(&mut self.source, other.source); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeAttachmentSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_attacher, + Key_node_name, + Key_source, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "attacher" => Field::Key_attacher, + "nodeName" => Field::Key_node_name, + "source" => Field::Key_source, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeAttachmentSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeAttachmentSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_attacher: Option = None; + let mut value_node_name: Option = None; + let mut value_source: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_attacher => value_attacher = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_node_name => value_node_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_source => value_source = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeAttachmentSpec { + attacher: value_attacher.unwrap_or_default(), + node_name: value_node_name.unwrap_or_default(), + source: value_source.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "VolumeAttachmentSpec", + &[ + "attacher", + "nodeName", + "source", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeAttachmentSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeAttachmentSpec", + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attacher", &self.attacher)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeName", &self.node_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "source", &self.source)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeAttachmentSpec { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeAttachmentSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeAttachmentSpec is the specification of a VolumeAttachment request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "attacher".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("attacher indicates the name of the volume driver that MUST handle this request. This is the name returned by GetPluginName().".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "nodeName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("nodeName represents the node that the volume should be attached to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "source".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("source represents the volume that should be attached.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "attacher".to_owned(), + "nodeName".to_owned(), + "source".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_attachment_status.rs b/src/v1_30/api/storage/v1/volume_attachment_status.rs new file mode 100644 index 000000000..b5814bca1 --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_attachment_status.rs @@ -0,0 +1,214 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeAttachmentStatus + +/// VolumeAttachmentStatus is the status of a VolumeAttachment request. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeAttachmentStatus { + /// attachError represents the last error encountered during attach operation, if any. This field must only be set by the entity completing the attach operation, i.e. the external-attacher. + pub attach_error: Option, + + /// attached indicates the volume is successfully attached. This field must only be set by the entity completing the attach operation, i.e. the external-attacher. + pub attached: bool, + + /// attachmentMetadata is populated with any information returned by the attach operation, upon successful attach, that must be passed into subsequent WaitForAttach or Mount calls. This field must only be set by the entity completing the attach operation, i.e. the external-attacher. + pub attachment_metadata: Option>, + + /// detachError represents the last error encountered during detach operation, if any. This field must only be set by the entity completing the detach operation, i.e. the external-attacher. + pub detach_error: Option, +} + +impl crate::DeepMerge for VolumeAttachmentStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.attach_error, other.attach_error); + crate::DeepMerge::merge_from(&mut self.attached, other.attached); + crate::merge_strategies::map::granular(&mut self.attachment_metadata, other.attachment_metadata, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.detach_error, other.detach_error); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeAttachmentStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_attach_error, + Key_attached, + Key_attachment_metadata, + Key_detach_error, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "attachError" => Field::Key_attach_error, + "attached" => Field::Key_attached, + "attachmentMetadata" => Field::Key_attachment_metadata, + "detachError" => Field::Key_detach_error, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeAttachmentStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeAttachmentStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_attach_error: Option = None; + let mut value_attached: Option = None; + let mut value_attachment_metadata: Option> = None; + let mut value_detach_error: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_attach_error => value_attach_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_attached => value_attached = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_attachment_metadata => value_attachment_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_detach_error => value_detach_error = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeAttachmentStatus { + attach_error: value_attach_error, + attached: value_attached.unwrap_or_default(), + attachment_metadata: value_attachment_metadata, + detach_error: value_detach_error, + }) + } + } + + deserializer.deserialize_struct( + "VolumeAttachmentStatus", + &[ + "attachError", + "attached", + "attachmentMetadata", + "detachError", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeAttachmentStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeAttachmentStatus", + 1 + + self.attach_error.as_ref().map_or(0, |_| 1) + + self.attachment_metadata.as_ref().map_or(0, |_| 1) + + self.detach_error.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.attach_error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attachError", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attached", &self.attached)?; + if let Some(value) = &self.attachment_metadata { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attachmentMetadata", value)?; + } + if let Some(value) = &self.detach_error { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "detachError", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeAttachmentStatus { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeAttachmentStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeAttachmentStatus is the status of a VolumeAttachment request.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "attachError".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("attachError represents the last error encountered during attach operation, if any. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "attached".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("attached indicates the volume is successfully attached. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "attachmentMetadata".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("attachmentMetadata is populated with any information returned by the attach operation, upon successful attach, that must be passed into subsequent WaitForAttach or Mount calls. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "detachError".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("detachError represents the last error encountered during detach operation, if any. This field must only be set by the entity completing the detach operation, i.e. the external-attacher.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "attached".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_error.rs b/src/v1_30/api/storage/v1/volume_error.rs new file mode 100644 index 000000000..3ee3324dd --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_error.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeError + +/// VolumeError captures an error encountered during a volume operation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeError { + /// message represents the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information. + pub message: Option, + + /// time represents the time the error was encountered. + pub time: Option, +} + +impl crate::DeepMerge for VolumeError { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.time, other.time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeError { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_message, + Key_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "message" => Field::Key_message, + "time" => Field::Key_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeError; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeError") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_message: Option = None; + let mut value_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_time => value_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeError { + message: value_message, + time: value_time, + }) + } + } + + deserializer.deserialize_struct( + "VolumeError", + &[ + "message", + "time", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeError { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeError", + self.message.as_ref().map_or(0, |_| 1) + + self.time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "time", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeError { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeError".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeError captures an error encountered during a volume operation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message represents the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "time".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("time represents the time the error was encountered.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1/volume_node_resources.rs b/src/v1_30/api/storage/v1/volume_node_resources.rs new file mode 100644 index 000000000..f6ecd1388 --- /dev/null +++ b/src/v1_30/api/storage/v1/volume_node_resources.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.api.storage.v1.VolumeNodeResources + +/// VolumeNodeResources is a set of resource limits for scheduling of volumes. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeNodeResources { + /// count indicates the maximum number of unique volumes managed by the CSI driver that can be used on a node. A volume that is both attached and mounted on a node is considered to be used once, not twice. The same rule applies for a unique volume that is shared among multiple pods on the same node. If this field is not specified, then the supported number of volumes on this node is unbounded. + pub count: Option, +} + +impl crate::DeepMerge for VolumeNodeResources { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.count, other.count); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeNodeResources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_count, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "count" => Field::Key_count, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeNodeResources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("VolumeNodeResources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_count: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_count => value_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeNodeResources { + count: value_count, + }) + } + } + + deserializer.deserialize_struct( + "VolumeNodeResources", + &[ + "count", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeNodeResources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "VolumeNodeResources", + self.count.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "count", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeNodeResources { + fn schema_name() -> String { + "io.k8s.api.storage.v1.VolumeNodeResources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeNodeResources is a set of resource limits for scheduling of volumes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "count".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("count indicates the maximum number of unique volumes managed by the CSI driver that can be used on a node. A volume that is both attached and mounted on a node is considered to be used once, not twice. The same rule applies for a unique volume that is shared among multiple pods on the same node. If this field is not specified, then the supported number of volumes on this node is unbounded.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storage/v1alpha1/mod.rs b/src/v1_30/api/storage/v1alpha1/mod.rs new file mode 100644 index 000000000..30d99df4d --- /dev/null +++ b/src/v1_30/api/storage/v1alpha1/mod.rs @@ -0,0 +1,3 @@ + +mod volume_attributes_class; +pub use self::volume_attributes_class::VolumeAttributesClass; diff --git a/src/v1_30/api/storage/v1alpha1/volume_attributes_class.rs b/src/v1_30/api/storage/v1alpha1/volume_attributes_class.rs new file mode 100644 index 000000000..c60ed8334 --- /dev/null +++ b/src/v1_30/api/storage/v1alpha1/volume_attributes_class.rs @@ -0,0 +1,256 @@ +// Generated from definition io.k8s.api.storage.v1alpha1.VolumeAttributesClass + +/// VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct VolumeAttributesClass { + /// Name of the CSI driver This field is immutable. + pub driver_name: String, + + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass. + /// + /// This field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an "Infeasible" state in the modifyVolumeStatus field. + pub parameters: Option>, +} + +impl crate::Resource for VolumeAttributesClass { + const API_VERSION: &'static str = "storage.k8s.io/v1alpha1"; + const GROUP: &'static str = "storage.k8s.io"; + const KIND: &'static str = "VolumeAttributesClass"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "volumeattributesclasses"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for VolumeAttributesClass { + const LIST_KIND: &'static str = "VolumeAttributesClassList"; +} + +impl crate::Metadata for VolumeAttributesClass { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for VolumeAttributesClass { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.driver_name, other.driver_name); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::merge_strategies::map::granular(&mut self.parameters, other.parameters, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for VolumeAttributesClass { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_driver_name, + Key_metadata, + Key_parameters, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "driverName" => Field::Key_driver_name, + "metadata" => Field::Key_metadata, + "parameters" => Field::Key_parameters, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = VolumeAttributesClass; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_driver_name: Option = None; + let mut value_metadata: Option = None; + let mut value_parameters: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_driver_name => value_driver_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_parameters => value_parameters = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(VolumeAttributesClass { + driver_name: value_driver_name.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + parameters: value_parameters, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "driverName", + "metadata", + "parameters", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for VolumeAttributesClass { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.parameters.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "driverName", &self.driver_name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.parameters { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "parameters", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for VolumeAttributesClass { + fn schema_name() -> String { + "io.k8s.api.storage.v1alpha1.VolumeAttributesClass".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("VolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "driverName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the CSI driver This field is immutable.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "parameters".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass.\n\nThis field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an \"Infeasible\" state in the modifyVolumeStatus field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "driverName".to_owned(), + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storagemigration/mod.rs b/src/v1_30/api/storagemigration/mod.rs new file mode 100644 index 000000000..32a5a9d4f --- /dev/null +++ b/src/v1_30/api/storagemigration/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha1; diff --git a/src/v1_30/api/storagemigration/v1alpha1/group_version_resource.rs b/src/v1_30/api/storagemigration/v1alpha1/group_version_resource.rs new file mode 100644 index 000000000..15320fe82 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/group_version_resource.rs @@ -0,0 +1,177 @@ +// Generated from definition io.k8s.api.storagemigration.v1alpha1.GroupVersionResource + +/// The names of the group, the version, and the resource. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GroupVersionResource { + /// The name of the group. + pub group: Option, + + /// The name of the resource. + pub resource: Option, + + /// The name of the version. + pub version: Option, +} + +impl crate::DeepMerge for GroupVersionResource { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + crate::DeepMerge::merge_from(&mut self.version, other.version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GroupVersionResource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group, + Key_resource, + Key_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "group" => Field::Key_group, + "resource" => Field::Key_resource, + "version" => Field::Key_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GroupVersionResource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GroupVersionResource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group: Option = None; + let mut value_resource: Option = None; + let mut value_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GroupVersionResource { + group: value_group, + resource: value_resource, + version: value_version, + }) + } + } + + deserializer.deserialize_struct( + "GroupVersionResource", + &[ + "group", + "resource", + "version", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GroupVersionResource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GroupVersionResource", + self.group.as_ref().map_or(0, |_| 1) + + self.resource.as_ref().map_or(0, |_| 1) + + self.version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + if let Some(value) = &self.resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", value)?; + } + if let Some(value) = &self.version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GroupVersionResource { + fn schema_name() -> String { + "io.k8s.api.storagemigration.v1alpha1.GroupVersionResource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The names of the group, the version, and the resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the group.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name of the version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storagemigration/v1alpha1/migration_condition.rs b/src/v1_30/api/storagemigration/v1alpha1/migration_condition.rs new file mode 100644 index 000000000..c6b210924 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/migration_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.api.storagemigration.v1alpha1.MigrationCondition + +/// Describes the state of a migration at a certain point. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MigrationCondition { + /// The last time this condition was updated. + pub last_update_time: Option, + + /// A human readable message indicating details about the transition. + pub message: Option, + + /// The reason for the condition's last transition. + pub reason: Option, + + /// Status of the condition, one of True, False, Unknown. + pub status: String, + + /// Type of the condition. + pub type_: String, +} + +impl crate::DeepMerge for MigrationCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_update_time, other.last_update_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MigrationCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_update_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastUpdateTime" => Field::Key_last_update_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MigrationCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MigrationCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_update_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_update_time => value_last_update_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(MigrationCondition { + last_update_time: value_last_update_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "MigrationCondition", + &[ + "lastUpdateTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for MigrationCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "MigrationCondition", + 2 + + self.last_update_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_update_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastUpdateTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MigrationCondition { + fn schema_name() -> String { + "io.k8s.api.storagemigration.v1alpha1.MigrationCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Describes the state of a migration at a certain point.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastUpdateTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The last time this condition was updated.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human readable message indicating details about the transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type of the condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storagemigration/v1alpha1/mod.rs b/src/v1_30/api/storagemigration/v1alpha1/mod.rs new file mode 100644 index 000000000..226b7d4b9 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/mod.rs @@ -0,0 +1,15 @@ + +mod group_version_resource; +pub use self::group_version_resource::GroupVersionResource; + +mod migration_condition; +pub use self::migration_condition::MigrationCondition; + +mod storage_version_migration; +pub use self::storage_version_migration::StorageVersionMigration; + +mod storage_version_migration_spec; +pub use self::storage_version_migration_spec::StorageVersionMigrationSpec; + +mod storage_version_migration_status; +pub use self::storage_version_migration_status::StorageVersionMigrationStatus; diff --git a/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration.rs b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration.rs new file mode 100644 index 000000000..c48cba282 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.api.storagemigration.v1alpha1.StorageVersionMigration + +/// StorageVersionMigration represents a migration of stored data to the latest storage version. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionMigration { + /// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Specification of the migration. + pub spec: Option, + + /// Status of the migration. + pub status: Option, +} + +impl crate::Resource for StorageVersionMigration { + const API_VERSION: &'static str = "storagemigration.k8s.io/v1alpha1"; + const GROUP: &'static str = "storagemigration.k8s.io"; + const KIND: &'static str = "StorageVersionMigration"; + const VERSION: &'static str = "v1alpha1"; + const URL_PATH_SEGMENT: &'static str = "storageversionmigrations"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for StorageVersionMigration { + const LIST_KIND: &'static str = "StorageVersionMigrationList"; +} + +impl crate::Metadata for StorageVersionMigration { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for StorageVersionMigration { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionMigration { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionMigration; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersionMigration { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersionMigration { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionMigration { + fn schema_name() -> String { + "io.k8s.api.storagemigration.v1alpha1.StorageVersionMigration".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StorageVersionMigration represents a migration of stored data to the latest storage version.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specification of the migration.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the migration.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_spec.rs b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_spec.rs new file mode 100644 index 000000000..5bbac69c0 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_spec.rs @@ -0,0 +1,153 @@ +// Generated from definition io.k8s.api.storagemigration.v1alpha1.StorageVersionMigrationSpec + +/// Spec of the storage version migration. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionMigrationSpec { + /// The token used in the list options to get the next chunk of objects to migrate. When the .status.conditions indicates the migration is "Running", users can use this token to check the progress of the migration. + pub continue_token: Option, + + /// The resource that is being migrated. The migrator sends requests to the endpoint serving the resource. Immutable. + pub resource: crate::api::storagemigration::v1alpha1::GroupVersionResource, +} + +impl crate::DeepMerge for StorageVersionMigrationSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.continue_token, other.continue_token); + crate::DeepMerge::merge_from(&mut self.resource, other.resource); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionMigrationSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_continue_token, + Key_resource, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "continueToken" => Field::Key_continue_token, + "resource" => Field::Key_resource, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionMigrationSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageVersionMigrationSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_continue_token: Option = None; + let mut value_resource: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_continue_token => value_continue_token = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource => value_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersionMigrationSpec { + continue_token: value_continue_token, + resource: value_resource.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "StorageVersionMigrationSpec", + &[ + "continueToken", + "resource", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersionMigrationSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageVersionMigrationSpec", + 1 + + self.continue_token.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.continue_token { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "continueToken", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resource", &self.resource)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionMigrationSpec { + fn schema_name() -> String { + "io.k8s.api.storagemigration.v1alpha1.StorageVersionMigrationSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec of the storage version migration.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "continueToken".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The token used in the list options to get the next chunk of objects to migrate. When the .status.conditions indicates the migration is \"Running\", users can use this token to check the progress of the migration.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resource".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The resource that is being migrated. The migrator sends requests to the endpoint serving the resource. Immutable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "resource".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_status.rs b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_status.rs new file mode 100644 index 000000000..141d913e4 --- /dev/null +++ b/src/v1_30/api/storagemigration/v1alpha1/storage_version_migration_status.rs @@ -0,0 +1,163 @@ +// Generated from definition io.k8s.api.storagemigration.v1alpha1.StorageVersionMigrationStatus + +/// Status of the storage version migration. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StorageVersionMigrationStatus { + /// The latest available observations of the migration's current state. + pub conditions: Option>, + + /// ResourceVersion to compare with the GC cache for performing the migration. This is the current resource version of given group, version and resource when kube-controller-manager first observes this StorageVersionMigration resource. + pub resource_version: Option, +} + +impl crate::DeepMerge for StorageVersionMigrationStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StorageVersionMigrationStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Key_resource_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + "resourceVersion" => Field::Key_resource_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StorageVersionMigrationStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StorageVersionMigrationStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + let mut value_resource_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StorageVersionMigrationStatus { + conditions: value_conditions, + resource_version: value_resource_version, + }) + } + } + + deserializer.deserialize_struct( + "StorageVersionMigrationStatus", + &[ + "conditions", + "resourceVersion", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StorageVersionMigrationStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StorageVersionMigrationStatus", + self.conditions.as_ref().map_or(0, |_| 1) + + self.resource_version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StorageVersionMigrationStatus { + fn schema_name() -> String { + "io.k8s.api.storagemigration.v1alpha1.StorageVersionMigrationStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the storage version migration.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The latest available observations of the migration's current state.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ResourceVersion to compare with the GC cache for performing the migration. This is the current resource version of given group, version and resource when kube-controller-manager first observes this StorageVersionMigration resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/mod.rs b/src/v1_30/apiextensions_apiserver/mod.rs new file mode 100644 index 000000000..38fda62c1 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_column_definition.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_column_definition.rs new file mode 100644 index 000000000..df7ac2e7d --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_column_definition.rs @@ -0,0 +1,250 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceColumnDefinition + +/// CustomResourceColumnDefinition specifies a column for server side printing. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceColumnDefinition { + /// description is a human readable description of this column. + pub description: Option, + + /// format is an optional OpenAPI type definition for this column. The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + pub format: Option, + + /// jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against each custom resource to produce the value for this column. + pub json_path: String, + + /// name is a human readable name for the column. + pub name: String, + + /// priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a priority greater than 0. + pub priority: Option, + + /// type is an OpenAPI type definition for this column. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + pub type_: String, +} + +impl crate::DeepMerge for CustomResourceColumnDefinition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.description, other.description); + crate::DeepMerge::merge_from(&mut self.format, other.format); + crate::DeepMerge::merge_from(&mut self.json_path, other.json_path); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.priority, other.priority); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceColumnDefinition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_description, + Key_format, + Key_json_path, + Key_name, + Key_priority, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "description" => Field::Key_description, + "format" => Field::Key_format, + "jsonPath" => Field::Key_json_path, + "name" => Field::Key_name, + "priority" => Field::Key_priority, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceColumnDefinition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceColumnDefinition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_description: Option = None; + let mut value_format: Option = None; + let mut value_json_path: Option = None; + let mut value_name: Option = None; + let mut value_priority: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_description => value_description = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_format => value_format = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_json_path => value_json_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_priority => value_priority = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceColumnDefinition { + description: value_description, + format: value_format, + json_path: value_json_path.unwrap_or_default(), + name: value_name.unwrap_or_default(), + priority: value_priority, + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceColumnDefinition", + &[ + "description", + "format", + "jsonPath", + "name", + "priority", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceColumnDefinition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceColumnDefinition", + 3 + + self.description.as_ref().map_or(0, |_| 1) + + self.format.as_ref().map_or(0, |_| 1) + + self.priority.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.description { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "description", value)?; + } + if let Some(value) = &self.format { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "format", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "jsonPath", &self.json_path)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.priority { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "priority", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceColumnDefinition { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceColumnDefinition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceColumnDefinition specifies a column for server side printing.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "description".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("description is a human readable description of this column.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "format".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("format is an optional OpenAPI type definition for this column. The 'name' format is applied to the primary identifier column to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "jsonPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against each custom resource to produce the value for this column.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is a human readable name for the column.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "priority".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a priority greater than 0.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is an OpenAPI type definition for this column. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "jsonPath".to_owned(), + "name".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_conversion.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_conversion.rs new file mode 100644 index 000000000..ccee4261c --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_conversion.rs @@ -0,0 +1,154 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceConversion + +/// CustomResourceConversion describes how to convert different versions of a CR. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceConversion { + /// strategy specifies how custom resources are converted between versions. Allowed values are: - `"None"`: The converter only change the apiVersion and would not touch any other field in the custom resource. - `"Webhook"`: API Server will call to an external webhook to do the conversion. Additional information + /// is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set. + pub strategy: String, + + /// webhook describes how to call the conversion webhook. Required when `strategy` is set to `"Webhook"`. + pub webhook: Option, +} + +impl crate::DeepMerge for CustomResourceConversion { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.strategy, other.strategy); + crate::DeepMerge::merge_from(&mut self.webhook, other.webhook); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceConversion { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_strategy, + Key_webhook, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "strategy" => Field::Key_strategy, + "webhook" => Field::Key_webhook, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceConversion; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceConversion") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_strategy: Option = None; + let mut value_webhook: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_strategy => value_strategy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_webhook => value_webhook = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceConversion { + strategy: value_strategy.unwrap_or_default(), + webhook: value_webhook, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceConversion", + &[ + "strategy", + "webhook", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceConversion { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceConversion", + 1 + + self.webhook.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "strategy", &self.strategy)?; + if let Some(value) = &self.webhook { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "webhook", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceConversion { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceConversion".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceConversion describes how to convert different versions of a CR.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "strategy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("strategy specifies how custom resources are converted between versions. Allowed values are: - `\"None\"`: The converter only change the apiVersion and would not touch any other field in the custom resource. - `\"Webhook\"`: API Server will call to an external webhook to do the conversion. Additional information\n is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "webhook".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("webhook describes how to call the conversion webhook. Required when `strategy` is set to `\"Webhook\"`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "strategy".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs new file mode 100644 index 000000000..be33903b7 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition.rs @@ -0,0 +1,243 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition + +/// CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format \<.spec.name\>.\<.spec.group\>. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinition { + /// Standard object's metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// spec describes how the user wants the resources to appear + pub spec: crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinitionSpec, + + /// status indicates the actual state of the CustomResourceDefinition + pub status: Option, +} + +impl crate::Resource for CustomResourceDefinition { + const API_VERSION: &'static str = "apiextensions.k8s.io/v1"; + const GROUP: &'static str = "apiextensions.k8s.io"; + const KIND: &'static str = "CustomResourceDefinition"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "customresourcedefinitions"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for CustomResourceDefinition { + const LIST_KIND: &'static str = "CustomResourceDefinitionList"; +} + +impl crate::Metadata for CustomResourceDefinition { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for CustomResourceDefinition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinition { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec.unwrap_or_default(), + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?; + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinition { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format <.spec.name>.<.spec.group>.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("spec describes how the user wants the resources to appear".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status indicates the actual state of the CustomResourceDefinition".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + "spec".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_condition.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_condition.rs new file mode 100644 index 000000000..977e76323 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionCondition + +/// CustomResourceDefinitionCondition contains details for the current condition of this pod. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinitionCondition { + /// lastTransitionTime last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// message is a human-readable message indicating details about last transition. + pub message: Option, + + /// reason is a unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// status is the status of the condition. Can be True, False, Unknown. + pub status: String, + + /// type is the type of the condition. Types include Established, NamesAccepted and Terminating. + pub type_: String, +} + +impl crate::DeepMerge for CustomResourceDefinitionCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinitionCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinitionCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceDefinitionCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinitionCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinitionCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceDefinitionCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinitionCondition { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinitionCondition contains details for the current condition of this pod.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastTransitionTime last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message is a human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason is a unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status is the status of the condition. Can be True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type is the type of the condition. Types include Established, NamesAccepted and Terminating.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_names.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_names.rs new file mode 100644 index 000000000..d10554280 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_names.rs @@ -0,0 +1,269 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionNames + +/// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinitionNames { + /// categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like `kubectl get all`. + pub categories: Option>, + + /// kind is the serialized kind of the resource. It is normally CamelCase and singular. Custom resource instances will use this value as the `kind` attribute in API calls. + pub kind: String, + + /// listKind is the serialized kind of the list for this resource. Defaults to "`kind`List". + pub list_kind: Option, + + /// plural is the plural name of the resource to serve. The custom resources are served under `/apis/\/\/.../\`. Must match the name of the CustomResourceDefinition (in the form `\.\`). Must be all lowercase. + pub plural: String, + + /// shortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like `kubectl get \`. It must be all lowercase. + pub short_names: Option>, + + /// singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`. + pub singular: Option, +} + +impl crate::DeepMerge for CustomResourceDefinitionNames { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.categories, other.categories); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.list_kind, other.list_kind); + crate::DeepMerge::merge_from(&mut self.plural, other.plural); + crate::merge_strategies::list::atomic(&mut self.short_names, other.short_names); + crate::DeepMerge::merge_from(&mut self.singular, other.singular); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinitionNames { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_categories, + Key_kind, + Key_list_kind, + Key_plural, + Key_short_names, + Key_singular, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "categories" => Field::Key_categories, + "kind" => Field::Key_kind, + "listKind" => Field::Key_list_kind, + "plural" => Field::Key_plural, + "shortNames" => Field::Key_short_names, + "singular" => Field::Key_singular, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinitionNames; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceDefinitionNames") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_categories: Option> = None; + let mut value_kind: Option = None; + let mut value_list_kind: Option = None; + let mut value_plural: Option = None; + let mut value_short_names: Option> = None; + let mut value_singular: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_categories => value_categories = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_list_kind => value_list_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_plural => value_plural = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_short_names => value_short_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_singular => value_singular = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinitionNames { + categories: value_categories, + kind: value_kind.unwrap_or_default(), + list_kind: value_list_kind, + plural: value_plural.unwrap_or_default(), + short_names: value_short_names, + singular: value_singular, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionNames", + &[ + "categories", + "kind", + "listKind", + "plural", + "shortNames", + "singular", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinitionNames { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceDefinitionNames", + 2 + + self.categories.as_ref().map_or(0, |_| 1) + + self.list_kind.as_ref().map_or(0, |_| 1) + + self.short_names.as_ref().map_or(0, |_| 1) + + self.singular.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.categories { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "categories", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + if let Some(value) = &self.list_kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "listKind", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "plural", &self.plural)?; + if let Some(value) = &self.short_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shortNames", value)?; + } + if let Some(value) = &self.singular { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "singular", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinitionNames { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionNames".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "categories".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like `kubectl get all`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind is the serialized kind of the resource. It is normally CamelCase and singular. Custom resource instances will use this value as the `kind` attribute in API calls.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "listKind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("listKind is the serialized kind of the list for this resource. Defaults to \"`kind`List\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "plural".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("plural is the plural name of the resource to serve. The custom resources are served under `/apis///.../`. Must match the name of the CustomResourceDefinition (in the form `.`). Must be all lowercase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "shortNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("shortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like `kubectl get `. It must be all lowercase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "singular".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "plural".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_spec.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_spec.rs new file mode 100644 index 000000000..f5a925cd0 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_spec.rs @@ -0,0 +1,251 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec + +/// CustomResourceDefinitionSpec describes how a user wants their resource to appear +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinitionSpec { + /// conversion defines conversion settings for the CRD. + pub conversion: Option, + + /// group is the API group of the defined custom resource. The custom resources are served under `/apis/\/...`. Must match the name of the CustomResourceDefinition (in the form `\.\`). + pub group: String, + + /// names specify the resource and kind names for the custom resource. + pub names: crate::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinitionNames, + + /// preserveUnknownFields indicates that object fields which are not specified in the OpenAPI schema should be preserved when persisting to storage. apiVersion, kind, metadata and known fields inside metadata are always preserved. This field is deprecated in favor of setting `x-preserve-unknown-fields` to true in `spec.versions\[*\].schema.openAPIV3Schema`. See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning for details. + pub preserve_unknown_fields: Option, + + /// scope indicates whether the defined custom resource is cluster- or namespace-scoped. Allowed values are `Cluster` and `Namespaced`. + pub scope: String, + + /// versions is the list of all API versions of the defined custom resource. Version names are used to compute the order in which served versions are listed in API discovery. 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. + pub versions: Vec, +} + +impl crate::DeepMerge for CustomResourceDefinitionSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.conversion, other.conversion); + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.names, other.names); + crate::DeepMerge::merge_from(&mut self.preserve_unknown_fields, other.preserve_unknown_fields); + crate::DeepMerge::merge_from(&mut self.scope, other.scope); + crate::merge_strategies::list::atomic(&mut self.versions, other.versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinitionSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conversion, + Key_group, + Key_names, + Key_preserve_unknown_fields, + Key_scope, + Key_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conversion" => Field::Key_conversion, + "group" => Field::Key_group, + "names" => Field::Key_names, + "preserveUnknownFields" => Field::Key_preserve_unknown_fields, + "scope" => Field::Key_scope, + "versions" => Field::Key_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinitionSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceDefinitionSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conversion: Option = None; + let mut value_group: Option = None; + let mut value_names: Option = None; + let mut value_preserve_unknown_fields: Option = None; + let mut value_scope: Option = None; + let mut value_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conversion => value_conversion = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_names => value_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_preserve_unknown_fields => value_preserve_unknown_fields = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_scope => value_scope = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_versions => value_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinitionSpec { + conversion: value_conversion, + group: value_group.unwrap_or_default(), + names: value_names.unwrap_or_default(), + preserve_unknown_fields: value_preserve_unknown_fields, + scope: value_scope.unwrap_or_default(), + versions: value_versions.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionSpec", + &[ + "conversion", + "group", + "names", + "preserveUnknownFields", + "scope", + "versions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinitionSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceDefinitionSpec", + 4 + + self.conversion.as_ref().map_or(0, |_| 1) + + self.preserve_unknown_fields.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conversion { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conversion", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", &self.group)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "names", &self.names)?; + if let Some(value) = &self.preserve_unknown_fields { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preserveUnknownFields", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scope", &self.scope)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "versions", &self.versions)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinitionSpec { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinitionSpec describes how a user wants their resource to appear".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conversion".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conversion defines conversion settings for the CRD.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("group is the API group of the defined custom resource. The custom resources are served under `/apis//...`. Must match the name of the CustomResourceDefinition (in the form `.`).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "names".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("names specify the resource and kind names for the custom resource.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "preserveUnknownFields".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("preserveUnknownFields indicates that object fields which are not specified in the OpenAPI schema should be preserved when persisting to storage. apiVersion, kind, metadata and known fields inside metadata are always preserved. This field is deprecated in favor of setting `x-preserve-unknown-fields` to true in `spec.versions[*].schema.openAPIV3Schema`. See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning for details.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "scope".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scope indicates whether the defined custom resource is cluster- or namespace-scoped. Allowed values are `Cluster` and `Namespaced`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "versions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("versions is the list of all API versions of the defined custom resource. Version names are used to compute the order in which served versions are listed in API discovery. 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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "group".to_owned(), + "names".to_owned(), + "scope".to_owned(), + "versions".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs new file mode 100644 index 000000000..d080a301d --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_status.rs @@ -0,0 +1,197 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionStatus + +/// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinitionStatus { + /// acceptedNames are the names that are actually being used to serve discovery. They may be different than the names in spec. + pub accepted_names: Option, + + /// conditions indicate state for particular aspects of a CustomResourceDefinition + pub conditions: Option>, + + /// storedVersions lists all versions of CustomResources that were ever persisted. Tracking these versions allows a migration path for stored versions in etcd. The field is mutable so a migration controller can finish a migration to another version (ensuring no old objects are left in storage), and then remove the rest of the versions from this list. Versions may not be removed from `spec.versions` while they exist in this list. + pub stored_versions: Option>, +} + +impl crate::DeepMerge for CustomResourceDefinitionStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.accepted_names, other.accepted_names); + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::merge_strategies::list::atomic(&mut self.stored_versions, other.stored_versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinitionStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_accepted_names, + Key_conditions, + Key_stored_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "acceptedNames" => Field::Key_accepted_names, + "conditions" => Field::Key_conditions, + "storedVersions" => Field::Key_stored_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinitionStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceDefinitionStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_accepted_names: Option = None; + let mut value_conditions: Option> = None; + let mut value_stored_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_accepted_names => value_accepted_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_stored_versions => value_stored_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinitionStatus { + accepted_names: value_accepted_names, + conditions: value_conditions, + stored_versions: value_stored_versions, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionStatus", + &[ + "acceptedNames", + "conditions", + "storedVersions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinitionStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceDefinitionStatus", + self.accepted_names.as_ref().map_or(0, |_| 1) + + self.conditions.as_ref().map_or(0, |_| 1) + + self.stored_versions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.accepted_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "acceptedNames", value)?; + } + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + if let Some(value) = &self.stored_versions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storedVersions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinitionStatus { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "acceptedNames".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("acceptedNames are the names that are actually being used to serve discovery. They may be different than the names in spec.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conditions indicate state for particular aspects of a CustomResourceDefinition".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "storedVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storedVersions lists all versions of CustomResources that were ever persisted. Tracking these versions allows a migration path for stored versions in etcd. The field is mutable so a migration controller can finish a migration to another version (ensuring no old objects are left in storage), and then remove the rest of the versions from this list. Versions may not be removed from `spec.versions` while they exist in this list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs new file mode 100644 index 000000000..c664eb290 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_definition_version.rs @@ -0,0 +1,332 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionVersion + +/// CustomResourceDefinitionVersion describes a version for CRD. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceDefinitionVersion { + /// additionalPrinterColumns specifies additional columns returned in Table output. See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. If no columns are specified, a single column displaying the age of the custom resource is used. + pub additional_printer_columns: Option>, + + /// deprecated indicates this version of the custom resource API is deprecated. When set to true, API requests to this version receive a warning header in the server response. Defaults to false. + pub deprecated: Option, + + /// deprecationWarning overrides the default warning returned to API clients. May only be set when `deprecated` is true. The default warning indicates this version is deprecated and recommends use of the newest served version of equal or greater stability, if one exists. + pub deprecation_warning: Option, + + /// name is the version name, e.g. “v1”, “v2beta1”, etc. The custom resources are served under this version at `/apis/\/\/...` if `served` is true. + pub name: String, + + /// schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource. + pub schema: Option, + + /// selectableFields specifies paths to fields that may be used as field selectors. A maximum of 8 selectable fields are allowed. See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors + pub selectable_fields: Option>, + + /// served is a flag enabling/disabling this version from being served via REST APIs + pub served: bool, + + /// storage indicates this version should be used when persisting custom resources to storage. There must be exactly one version with storage=true. + pub storage: bool, + + /// subresources specify what subresources this version of the defined custom resource have. + pub subresources: Option, +} + +impl crate::DeepMerge for CustomResourceDefinitionVersion { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.additional_printer_columns, other.additional_printer_columns); + crate::DeepMerge::merge_from(&mut self.deprecated, other.deprecated); + crate::DeepMerge::merge_from(&mut self.deprecation_warning, other.deprecation_warning); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.schema, other.schema); + crate::merge_strategies::list::atomic(&mut self.selectable_fields, other.selectable_fields); + crate::DeepMerge::merge_from(&mut self.served, other.served); + crate::DeepMerge::merge_from(&mut self.storage, other.storage); + crate::DeepMerge::merge_from(&mut self.subresources, other.subresources); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceDefinitionVersion { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_additional_printer_columns, + Key_deprecated, + Key_deprecation_warning, + Key_name, + Key_schema, + Key_selectable_fields, + Key_served, + Key_storage, + Key_subresources, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "additionalPrinterColumns" => Field::Key_additional_printer_columns, + "deprecated" => Field::Key_deprecated, + "deprecationWarning" => Field::Key_deprecation_warning, + "name" => Field::Key_name, + "schema" => Field::Key_schema, + "selectableFields" => Field::Key_selectable_fields, + "served" => Field::Key_served, + "storage" => Field::Key_storage, + "subresources" => Field::Key_subresources, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceDefinitionVersion; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceDefinitionVersion") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_additional_printer_columns: Option> = None; + let mut value_deprecated: Option = None; + let mut value_deprecation_warning: Option = None; + let mut value_name: Option = None; + let mut value_schema: Option = None; + let mut value_selectable_fields: Option> = None; + let mut value_served: Option = None; + let mut value_storage: Option = None; + let mut value_subresources: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_additional_printer_columns => value_additional_printer_columns = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecated => value_deprecated = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deprecation_warning => value_deprecation_warning = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_schema => value_schema = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_selectable_fields => value_selectable_fields = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_served => value_served = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage => value_storage = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subresources => value_subresources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceDefinitionVersion { + additional_printer_columns: value_additional_printer_columns, + deprecated: value_deprecated, + deprecation_warning: value_deprecation_warning, + name: value_name.unwrap_or_default(), + schema: value_schema, + selectable_fields: value_selectable_fields, + served: value_served.unwrap_or_default(), + storage: value_storage.unwrap_or_default(), + subresources: value_subresources, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceDefinitionVersion", + &[ + "additionalPrinterColumns", + "deprecated", + "deprecationWarning", + "name", + "schema", + "selectableFields", + "served", + "storage", + "subresources", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceDefinitionVersion { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceDefinitionVersion", + 3 + + self.additional_printer_columns.as_ref().map_or(0, |_| 1) + + self.deprecated.as_ref().map_or(0, |_| 1) + + self.deprecation_warning.as_ref().map_or(0, |_| 1) + + self.schema.as_ref().map_or(0, |_| 1) + + self.selectable_fields.as_ref().map_or(0, |_| 1) + + self.subresources.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.additional_printer_columns { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "additionalPrinterColumns", value)?; + } + if let Some(value) = &self.deprecated { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecated", value)?; + } + if let Some(value) = &self.deprecation_warning { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deprecationWarning", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.schema { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "schema", value)?; + } + if let Some(value) = &self.selectable_fields { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selectableFields", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "served", &self.served)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storage", &self.storage)?; + if let Some(value) = &self.subresources { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subresources", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceDefinitionVersion { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionVersion".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceDefinitionVersion describes a version for CRD.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "additionalPrinterColumns".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("additionalPrinterColumns specifies additional columns returned in Table output. See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. If no columns are specified, a single column displaying the age of the custom resource is used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "deprecated".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecated indicates this version of the custom resource API is deprecated. When set to true, API requests to this version receive a warning header in the server response. Defaults to false.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "deprecationWarning".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("deprecationWarning overrides the default warning returned to API clients. May only be set when `deprecated` is true. The default warning indicates this version is deprecated and recommends use of the newest served version of equal or greater stability, if one exists.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the version name, e.g. “v1”, “v2beta1”, etc. The custom resources are served under this version at `/apis///...` if `served` is true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "schema".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "selectableFields".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("selectableFields specifies paths to fields that may be used as field selectors. A maximum of 8 selectable fields are allowed. See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "served".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("served is a flag enabling/disabling this version from being served via REST APIs".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "storage".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("storage indicates this version should be used when persisting custom resources to storage. There must be exactly one version with storage=true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "subresources".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("subresources specify what subresources this version of the defined custom resource have.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "name".to_owned(), + "served".to_owned(), + "storage".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_scale.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_scale.rs new file mode 100644 index 000000000..3a463e63f --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_scale.rs @@ -0,0 +1,176 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceScale + +/// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceSubresourceScale { + /// labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status` or `.spec`. Must be set to work with HorizontalPodAutoscaler. The field pointed by this JSON path must be a string field (not a complex selector struct) which contains a serialized label selector in string form. More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` subresource will default to the empty string. + pub label_selector_path: Option, + + /// specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.spec`. If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. + pub spec_replicas_path: String, + + /// statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status`. If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource will default to 0. + pub status_replicas_path: String, +} + +impl crate::DeepMerge for CustomResourceSubresourceScale { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.label_selector_path, other.label_selector_path); + crate::DeepMerge::merge_from(&mut self.spec_replicas_path, other.spec_replicas_path); + crate::DeepMerge::merge_from(&mut self.status_replicas_path, other.status_replicas_path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceSubresourceScale { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_label_selector_path, + Key_spec_replicas_path, + Key_status_replicas_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "labelSelectorPath" => Field::Key_label_selector_path, + "specReplicasPath" => Field::Key_spec_replicas_path, + "statusReplicasPath" => Field::Key_status_replicas_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceSubresourceScale; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceSubresourceScale") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_label_selector_path: Option = None; + let mut value_spec_replicas_path: Option = None; + let mut value_status_replicas_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_label_selector_path => value_label_selector_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec_replicas_path => value_spec_replicas_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status_replicas_path => value_status_replicas_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceSubresourceScale { + label_selector_path: value_label_selector_path, + spec_replicas_path: value_spec_replicas_path.unwrap_or_default(), + status_replicas_path: value_status_replicas_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceSubresourceScale", + &[ + "labelSelectorPath", + "specReplicasPath", + "statusReplicasPath", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceSubresourceScale { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceSubresourceScale", + 2 + + self.label_selector_path.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.label_selector_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "labelSelectorPath", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "specReplicasPath", &self.spec_replicas_path)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "statusReplicasPath", &self.status_replicas_path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceSubresourceScale { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceScale".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "labelSelectorPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status` or `.spec`. Must be set to work with HorizontalPodAutoscaler. The field pointed by this JSON path must be a string field (not a complex selector struct) which contains a serialized label selector in string form. More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` subresource will default to the empty string.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "specReplicasPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.spec`. If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "statusReplicasPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. Only JSON paths without the array notation are allowed. Must be a JSON Path under `.status`. If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource will default to 0.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "specReplicasPath".to_owned(), + "statusReplicasPath".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_status.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_status.rs new file mode 100644 index 000000000..8983293b8 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresource_status.rs @@ -0,0 +1,55 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceStatus + +/// CustomResourceSubresourceStatus defines how to serve the status subresource for CustomResources. Status is represented by the `.status` JSON path inside of a CustomResource. When set, * exposes a /status subresource for the custom resource * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceSubresourceStatus(pub crate::serde_json::Value); + +impl crate::DeepMerge for CustomResourceSubresourceStatus { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceSubresourceStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceSubresourceStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceSubresourceStatus") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(CustomResourceSubresourceStatus(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("CustomResourceSubresourceStatus", Visitor) + } +} + +impl crate::serde::Serialize for CustomResourceSubresourceStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("CustomResourceSubresourceStatus", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceSubresourceStatus { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresourceStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceSubresourceStatus defines how to serve the status subresource for CustomResources. Status is represented by the `.status` JSON path inside of a CustomResource. When set, * exposes a /status subresource for the custom resource * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresources.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresources.rs new file mode 100644 index 000000000..2133dac77 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_subresources.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresources + +/// CustomResourceSubresources defines the status and scale subresources for CustomResources. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceSubresources { + /// scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. + pub scale: Option, + + /// status indicates the custom resource should serve a `/status` subresource. When enabled: 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. + pub status: Option, +} + +impl crate::DeepMerge for CustomResourceSubresources { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.scale, other.scale); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceSubresources { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_scale, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "scale" => Field::Key_scale, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceSubresources; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceSubresources") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_scale: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_scale => value_scale = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceSubresources { + scale: value_scale, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceSubresources", + &[ + "scale", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceSubresources { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceSubresources", + self.scale.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.scale { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scale", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceSubresources { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceSubresources".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceSubresources defines the status and scale subresources for CustomResources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "scale".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status indicates the custom resource should serve a `/status` subresource. When enabled: 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_validation.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_validation.rs new file mode 100644 index 000000000..52df6af7c --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/custom_resource_validation.rs @@ -0,0 +1,127 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceValidation + +/// CustomResourceValidation is a list of validation methods for CustomResources. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct CustomResourceValidation { + /// openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. + pub open_api_v3_schema: Option, +} + +impl crate::DeepMerge for CustomResourceValidation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.open_api_v3_schema, other.open_api_v3_schema); + } +} + +impl<'de> crate::serde::Deserialize<'de> for CustomResourceValidation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_open_api_v3_schema, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "openAPIV3Schema" => Field::Key_open_api_v3_schema, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = CustomResourceValidation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("CustomResourceValidation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_open_api_v3_schema: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_open_api_v3_schema => value_open_api_v3_schema = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(CustomResourceValidation { + open_api_v3_schema: value_open_api_v3_schema, + }) + } + } + + deserializer.deserialize_struct( + "CustomResourceValidation", + &[ + "openAPIV3Schema", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for CustomResourceValidation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "CustomResourceValidation", + self.open_api_v3_schema.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.open_api_v3_schema { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "openAPIV3Schema", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for CustomResourceValidation { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceValidation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CustomResourceValidation is a list of validation methods for CustomResources.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "openAPIV3Schema".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/external_documentation.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/external_documentation.rs new file mode 100644 index 000000000..1b9d11980 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/external_documentation.rs @@ -0,0 +1,142 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ExternalDocumentation + +/// ExternalDocumentation allows referencing an external resource for extended documentation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ExternalDocumentation { + pub description: Option, + + pub url: Option, +} + +impl crate::DeepMerge for ExternalDocumentation { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.description, other.description); + crate::DeepMerge::merge_from(&mut self.url, other.url); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ExternalDocumentation { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_description, + Key_url, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "description" => Field::Key_description, + "url" => Field::Key_url, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ExternalDocumentation; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ExternalDocumentation") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_description: Option = None; + let mut value_url: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_description => value_description = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_url => value_url = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ExternalDocumentation { + description: value_description, + url: value_url, + }) + } + } + + deserializer.deserialize_struct( + "ExternalDocumentation", + &[ + "description", + "url", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ExternalDocumentation { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ExternalDocumentation", + self.description.as_ref().map_or(0, |_| 1) + + self.url.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.description { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "description", value)?; + } + if let Some(value) = &self.url { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "url", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ExternalDocumentation { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ExternalDocumentation".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ExternalDocumentation allows referencing an external resource for extended documentation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "description".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "url".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json.rs new file mode 100644 index 000000000..298851935 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json.rs @@ -0,0 +1,55 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON + +/// JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, \[\]interface{}, map\[string\]interface{} and nil. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JSON(pub crate::serde_json::Value); + +impl crate::DeepMerge for JSON { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JSON { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JSON; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JSON") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(JSON(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("JSON", Visitor) + } +} + +impl crate::serde::Serialize for JSON { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("JSON", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JSON { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSON".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs new file mode 100644 index 000000000..a871ebe8a --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props.rs @@ -0,0 +1,1122 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps + +/// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct JSONSchemaProps { + pub ref_path: Option, + + pub schema: Option, + + pub additional_items: Option, + + pub additional_properties: Option, + + pub all_of: Option>, + + pub any_of: Option>, + + /// default is a default value for undefined object fields. Defaulting is a beta feature under the CustomResourceDefaulting feature gate. Defaulting requires spec.preserveUnknownFields to be false. + pub default: Option, + + pub definitions: Option>, + + pub dependencies: Option>, + + pub description: Option, + + pub enum_: Option>, + + pub example: Option, + + pub exclusive_maximum: Option, + + pub exclusive_minimum: Option, + + pub external_docs: Option, + + /// format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated: + /// + /// - bsonobjectid: a bson object ID, i.e. a 24 characters hex string - uri: an URI as parsed by Golang net/url.ParseRequestURI - email: an email address as parsed by Golang net/mail.ParseAddress - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 \[RFC1034\]. - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - cidr: a CIDR as parsed by Golang net.ParseCIDR - mac: a MAC address as parsed by Golang net.ParseMAC - uuid: an UUID that allows uppercase defined by the regex (?i)^\[0-9a-f\]{8}-?\[0-9a-f\]{4}-?\[0-9a-f\]{4}-?\[0-9a-f\]{4}-?\[0-9a-f\]{12}$ - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^\[0-9a-f\]{8}-?\[0-9a-f\]{4}-?3\[0-9a-f\]{3}-?\[0-9a-f\]{4}-?\[0-9a-f\]{12}$ - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^\[0-9a-f\]{8}-?\[0-9a-f\]{4}-?4\[0-9a-f\]{3}-?\[89ab\]\[0-9a-f\]{3}-?\[0-9a-f\]{12}$ - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^\[0-9a-f\]{8}-?\[0-9a-f\]{4}-?5\[0-9a-f\]{3}-?\[89ab\]\[0-9a-f\]{3}-?\[0-9a-f\]{12}$ - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" - isbn10: an ISBN10 number string like "0321751043" - isbn13: an ISBN13 number string like "978-0321751041" - creditcard: a credit card number defined by the regex ^(?:4\[0-9\]{12}(?:\[0-9\]{3})?|5\[1-5\]\[0-9\]{14}|6(?:011|5\[0-9\]\[0-9\])\[0-9\]{12}|3\[47\]\[0-9\]{13}|3(?:0\[0-5\]|\[68\]\[0-9\])\[0-9\]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in - ssn: a U.S. social security number following the regex ^\\d{3}\[- \]?\\d{2}\[- \]?\\d{4}$ - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?(\[0-9a-fA-F\]{3}|\[0-9a-fA-F\]{6})$ - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" - byte: base64 encoded binary data - password: any kind of string - date: a date string like "2006-01-02" as defined by full-date in RFC3339 - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. + pub format: Option, + + pub id: Option, + + pub items: Option, + + pub max_items: Option, + + pub max_length: Option, + + pub max_properties: Option, + + pub maximum: Option, + + pub min_items: Option, + + pub min_length: Option, + + pub min_properties: Option, + + pub minimum: Option, + + pub multiple_of: Option, + + pub not: Option>, + + pub nullable: Option, + + pub one_of: Option>, + + pub pattern: Option, + + pub pattern_properties: Option>, + + pub properties: Option>, + + pub required: Option>, + + pub title: Option, + + pub type_: Option, + + pub unique_items: Option, + + /// x-kubernetes-embedded-resource defines that the value is an embedded Kubernetes runtime.Object, with TypeMeta and ObjectMeta. The type must be object. It is allowed to further restrict the embedded object. kind, apiVersion and metadata are validated automatically. x-kubernetes-preserve-unknown-fields is allowed to be true, but does not have to be if the object is fully specified (up to kind, apiVersion, metadata). + pub x_kubernetes_embedded_resource: Option, + + /// x-kubernetes-int-or-string specifies that this value is either an integer or a string. If this is true, an empty type is allowed and type as child of anyOf is permitted if following one of the following patterns: + /// + /// 1) anyOf: + /// - type: integer + /// - type: string + /// 2) allOf: + /// - anyOf: + /// - type: integer + /// - type: string + /// - ... zero or more + pub x_kubernetes_int_or_string: Option, + + /// x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used as the index of the map. + /// + /// This tag MUST only be used on lists that have the "x-kubernetes-list-type" extension set to "map". Also, the values specified for this attribute must be a scalar typed field of the child structure (no nesting is supported). + /// + /// The properties specified must either be required or have a default value, to ensure those properties are present for all list items. + pub x_kubernetes_list_map_keys: Option>, + + /// x-kubernetes-list-type annotates an array to further describe its topology. This extension must only be used on lists and may have 3 possible values: + /// + /// 1) `atomic`: the list is treated as a single entity, like a scalar. + /// Atomic lists will be entirely replaced when updated. This extension + /// may be used on any type of list (struct, scalar, ...). + /// 2) `set`: + /// Sets are lists that must not have multiple items with the same value. Each + /// value must be a scalar, an object with x-kubernetes-map-type `atomic` or an + /// array with x-kubernetes-list-type `atomic`. + /// 3) `map`: + /// These lists are like maps in that their elements have a non-index key + /// used to identify them. Order is preserved upon merge. The map tag + /// must only be used on a list with elements of type object. + /// Defaults to atomic for arrays. + pub x_kubernetes_list_type: Option, + + /// x-kubernetes-map-type annotates an object to further describe its topology. This extension must only be used when type is object and may have 2 possible values: + /// + /// 1) `granular`: + /// These maps are actual maps (key-value pairs) and each fields are independent + /// from each other (they can each be manipulated by separate actors). This is + /// the default behaviour for all maps. + /// 2) `atomic`: the list is treated as a single entity, like a scalar. + /// Atomic maps will be entirely replaced when updated. + pub x_kubernetes_map_type: Option, + + /// x-kubernetes-preserve-unknown-fields stops the API server decoding step from pruning fields which are not specified in the validation schema. This affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden. + pub x_kubernetes_preserve_unknown_fields: Option, + + /// x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. + pub x_kubernetes_validations: Option>, +} + +impl crate::DeepMerge for JSONSchemaProps { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ref_path, other.ref_path); + crate::DeepMerge::merge_from(&mut self.schema, other.schema); + crate::DeepMerge::merge_from(&mut self.additional_items, other.additional_items); + crate::DeepMerge::merge_from(&mut self.additional_properties, other.additional_properties); + crate::merge_strategies::list::atomic(&mut self.all_of, other.all_of); + crate::merge_strategies::list::atomic(&mut self.any_of, other.any_of); + crate::DeepMerge::merge_from(&mut self.default, other.default); + crate::merge_strategies::map::granular(&mut self.definitions, other.definitions, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.dependencies, other.dependencies, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.description, other.description); + crate::merge_strategies::list::atomic(&mut self.enum_, other.enum_); + crate::DeepMerge::merge_from(&mut self.example, other.example); + crate::DeepMerge::merge_from(&mut self.exclusive_maximum, other.exclusive_maximum); + crate::DeepMerge::merge_from(&mut self.exclusive_minimum, other.exclusive_minimum); + crate::DeepMerge::merge_from(&mut self.external_docs, other.external_docs); + crate::DeepMerge::merge_from(&mut self.format, other.format); + crate::DeepMerge::merge_from(&mut self.id, other.id); + crate::DeepMerge::merge_from(&mut self.items, other.items); + crate::DeepMerge::merge_from(&mut self.max_items, other.max_items); + crate::DeepMerge::merge_from(&mut self.max_length, other.max_length); + crate::DeepMerge::merge_from(&mut self.max_properties, other.max_properties); + crate::DeepMerge::merge_from(&mut self.maximum, other.maximum); + crate::DeepMerge::merge_from(&mut self.min_items, other.min_items); + crate::DeepMerge::merge_from(&mut self.min_length, other.min_length); + crate::DeepMerge::merge_from(&mut self.min_properties, other.min_properties); + crate::DeepMerge::merge_from(&mut self.minimum, other.minimum); + crate::DeepMerge::merge_from(&mut self.multiple_of, other.multiple_of); + crate::DeepMerge::merge_from(&mut self.not, other.not); + crate::DeepMerge::merge_from(&mut self.nullable, other.nullable); + crate::merge_strategies::list::atomic(&mut self.one_of, other.one_of); + crate::DeepMerge::merge_from(&mut self.pattern, other.pattern); + crate::merge_strategies::map::granular(&mut self.pattern_properties, other.pattern_properties, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::map::granular(&mut self.properties, other.properties, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::list::atomic(&mut self.required, other.required); + crate::DeepMerge::merge_from(&mut self.title, other.title); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + crate::DeepMerge::merge_from(&mut self.unique_items, other.unique_items); + crate::DeepMerge::merge_from(&mut self.x_kubernetes_embedded_resource, other.x_kubernetes_embedded_resource); + crate::DeepMerge::merge_from(&mut self.x_kubernetes_int_or_string, other.x_kubernetes_int_or_string); + crate::merge_strategies::list::atomic(&mut self.x_kubernetes_list_map_keys, other.x_kubernetes_list_map_keys); + crate::DeepMerge::merge_from(&mut self.x_kubernetes_list_type, other.x_kubernetes_list_type); + crate::DeepMerge::merge_from(&mut self.x_kubernetes_map_type, other.x_kubernetes_map_type); + crate::DeepMerge::merge_from(&mut self.x_kubernetes_preserve_unknown_fields, other.x_kubernetes_preserve_unknown_fields); + crate::merge_strategies::list::map( + &mut self.x_kubernetes_validations, + other.x_kubernetes_validations, + &[|lhs, rhs| lhs.rule == rhs.rule], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for JSONSchemaProps { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ref_path, + Key_schema, + Key_additional_items, + Key_additional_properties, + Key_all_of, + Key_any_of, + Key_default, + Key_definitions, + Key_dependencies, + Key_description, + Key_enum_, + Key_example, + Key_exclusive_maximum, + Key_exclusive_minimum, + Key_external_docs, + Key_format, + Key_id, + Key_items, + Key_max_items, + Key_max_length, + Key_max_properties, + Key_maximum, + Key_min_items, + Key_min_length, + Key_min_properties, + Key_minimum, + Key_multiple_of, + Key_not, + Key_nullable, + Key_one_of, + Key_pattern, + Key_pattern_properties, + Key_properties, + Key_required, + Key_title, + Key_type_, + Key_unique_items, + Key_x_kubernetes_embedded_resource, + Key_x_kubernetes_int_or_string, + Key_x_kubernetes_list_map_keys, + Key_x_kubernetes_list_type, + Key_x_kubernetes_map_type, + Key_x_kubernetes_preserve_unknown_fields, + Key_x_kubernetes_validations, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "$ref" => Field::Key_ref_path, + "$schema" => Field::Key_schema, + "additionalItems" => Field::Key_additional_items, + "additionalProperties" => Field::Key_additional_properties, + "allOf" => Field::Key_all_of, + "anyOf" => Field::Key_any_of, + "default" => Field::Key_default, + "definitions" => Field::Key_definitions, + "dependencies" => Field::Key_dependencies, + "description" => Field::Key_description, + "enum" => Field::Key_enum_, + "example" => Field::Key_example, + "exclusiveMaximum" => Field::Key_exclusive_maximum, + "exclusiveMinimum" => Field::Key_exclusive_minimum, + "externalDocs" => Field::Key_external_docs, + "format" => Field::Key_format, + "id" => Field::Key_id, + "items" => Field::Key_items, + "maxItems" => Field::Key_max_items, + "maxLength" => Field::Key_max_length, + "maxProperties" => Field::Key_max_properties, + "maximum" => Field::Key_maximum, + "minItems" => Field::Key_min_items, + "minLength" => Field::Key_min_length, + "minProperties" => Field::Key_min_properties, + "minimum" => Field::Key_minimum, + "multipleOf" => Field::Key_multiple_of, + "not" => Field::Key_not, + "nullable" => Field::Key_nullable, + "oneOf" => Field::Key_one_of, + "pattern" => Field::Key_pattern, + "patternProperties" => Field::Key_pattern_properties, + "properties" => Field::Key_properties, + "required" => Field::Key_required, + "title" => Field::Key_title, + "type" => Field::Key_type_, + "uniqueItems" => Field::Key_unique_items, + "x-kubernetes-embedded-resource" => Field::Key_x_kubernetes_embedded_resource, + "x-kubernetes-int-or-string" => Field::Key_x_kubernetes_int_or_string, + "x-kubernetes-list-map-keys" => Field::Key_x_kubernetes_list_map_keys, + "x-kubernetes-list-type" => Field::Key_x_kubernetes_list_type, + "x-kubernetes-map-type" => Field::Key_x_kubernetes_map_type, + "x-kubernetes-preserve-unknown-fields" => Field::Key_x_kubernetes_preserve_unknown_fields, + "x-kubernetes-validations" => Field::Key_x_kubernetes_validations, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JSONSchemaProps; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JSONSchemaProps") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ref_path: Option = None; + let mut value_schema: Option = None; + let mut value_additional_items: Option = None; + let mut value_additional_properties: Option = None; + let mut value_all_of: Option> = None; + let mut value_any_of: Option> = None; + let mut value_default: Option = None; + let mut value_definitions: Option> = None; + let mut value_dependencies: Option> = None; + let mut value_description: Option = None; + let mut value_enum_: Option> = None; + let mut value_example: Option = None; + let mut value_exclusive_maximum: Option = None; + let mut value_exclusive_minimum: Option = None; + let mut value_external_docs: Option = None; + let mut value_format: Option = None; + let mut value_id: Option = None; + let mut value_items: Option = None; + let mut value_max_items: Option = None; + let mut value_max_length: Option = None; + let mut value_max_properties: Option = None; + let mut value_maximum: Option = None; + let mut value_min_items: Option = None; + let mut value_min_length: Option = None; + let mut value_min_properties: Option = None; + let mut value_minimum: Option = None; + let mut value_multiple_of: Option = None; + let mut value_not: Option> = None; + let mut value_nullable: Option = None; + let mut value_one_of: Option> = None; + let mut value_pattern: Option = None; + let mut value_pattern_properties: Option> = None; + let mut value_properties: Option> = None; + let mut value_required: Option> = None; + let mut value_title: Option = None; + let mut value_type_: Option = None; + let mut value_unique_items: Option = None; + let mut value_x_kubernetes_embedded_resource: Option = None; + let mut value_x_kubernetes_int_or_string: Option = None; + let mut value_x_kubernetes_list_map_keys: Option> = None; + let mut value_x_kubernetes_list_type: Option = None; + let mut value_x_kubernetes_map_type: Option = None; + let mut value_x_kubernetes_preserve_unknown_fields: Option = None; + let mut value_x_kubernetes_validations: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ref_path => value_ref_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_schema => value_schema = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_additional_items => value_additional_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_additional_properties => value_additional_properties = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_all_of => value_all_of = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_any_of => value_any_of = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_default => value_default = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_definitions => value_definitions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_dependencies => value_dependencies = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_description => value_description = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_enum_ => value_enum_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_example => value_example = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_exclusive_maximum => value_exclusive_maximum = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_exclusive_minimum => value_exclusive_minimum = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_external_docs => value_external_docs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_format => value_format = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_id => value_id = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_items => value_max_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_length => value_max_length = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_max_properties => value_max_properties = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_maximum => value_maximum = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_items => value_min_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_length => value_min_length = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_min_properties => value_min_properties = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_minimum => value_minimum = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_multiple_of => value_multiple_of = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_not => value_not = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_nullable => value_nullable = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_one_of => value_one_of = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pattern => value_pattern = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_pattern_properties => value_pattern_properties = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_properties => value_properties = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_required => value_required = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_title => value_title = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_unique_items => value_unique_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_embedded_resource => value_x_kubernetes_embedded_resource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_int_or_string => value_x_kubernetes_int_or_string = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_list_map_keys => value_x_kubernetes_list_map_keys = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_list_type => value_x_kubernetes_list_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_map_type => value_x_kubernetes_map_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_preserve_unknown_fields => value_x_kubernetes_preserve_unknown_fields = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_x_kubernetes_validations => value_x_kubernetes_validations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(JSONSchemaProps { + ref_path: value_ref_path, + schema: value_schema, + additional_items: value_additional_items, + additional_properties: value_additional_properties, + all_of: value_all_of, + any_of: value_any_of, + default: value_default, + definitions: value_definitions, + dependencies: value_dependencies, + description: value_description, + enum_: value_enum_, + example: value_example, + exclusive_maximum: value_exclusive_maximum, + exclusive_minimum: value_exclusive_minimum, + external_docs: value_external_docs, + format: value_format, + id: value_id, + items: value_items, + max_items: value_max_items, + max_length: value_max_length, + max_properties: value_max_properties, + maximum: value_maximum, + min_items: value_min_items, + min_length: value_min_length, + min_properties: value_min_properties, + minimum: value_minimum, + multiple_of: value_multiple_of, + not: value_not, + nullable: value_nullable, + one_of: value_one_of, + pattern: value_pattern, + pattern_properties: value_pattern_properties, + properties: value_properties, + required: value_required, + title: value_title, + type_: value_type_, + unique_items: value_unique_items, + x_kubernetes_embedded_resource: value_x_kubernetes_embedded_resource, + x_kubernetes_int_or_string: value_x_kubernetes_int_or_string, + x_kubernetes_list_map_keys: value_x_kubernetes_list_map_keys, + x_kubernetes_list_type: value_x_kubernetes_list_type, + x_kubernetes_map_type: value_x_kubernetes_map_type, + x_kubernetes_preserve_unknown_fields: value_x_kubernetes_preserve_unknown_fields, + x_kubernetes_validations: value_x_kubernetes_validations, + }) + } + } + + deserializer.deserialize_struct( + "JSONSchemaProps", + &[ + "$ref", + "$schema", + "additionalItems", + "additionalProperties", + "allOf", + "anyOf", + "default", + "definitions", + "dependencies", + "description", + "enum", + "example", + "exclusiveMaximum", + "exclusiveMinimum", + "externalDocs", + "format", + "id", + "items", + "maxItems", + "maxLength", + "maxProperties", + "maximum", + "minItems", + "minLength", + "minProperties", + "minimum", + "multipleOf", + "not", + "nullable", + "oneOf", + "pattern", + "patternProperties", + "properties", + "required", + "title", + "type", + "uniqueItems", + "x-kubernetes-embedded-resource", + "x-kubernetes-int-or-string", + "x-kubernetes-list-map-keys", + "x-kubernetes-list-type", + "x-kubernetes-map-type", + "x-kubernetes-preserve-unknown-fields", + "x-kubernetes-validations", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for JSONSchemaProps { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "JSONSchemaProps", + self.ref_path.as_ref().map_or(0, |_| 1) + + self.schema.as_ref().map_or(0, |_| 1) + + self.additional_items.as_ref().map_or(0, |_| 1) + + self.additional_properties.as_ref().map_or(0, |_| 1) + + self.all_of.as_ref().map_or(0, |_| 1) + + self.any_of.as_ref().map_or(0, |_| 1) + + self.default.as_ref().map_or(0, |_| 1) + + self.definitions.as_ref().map_or(0, |_| 1) + + self.dependencies.as_ref().map_or(0, |_| 1) + + self.description.as_ref().map_or(0, |_| 1) + + self.enum_.as_ref().map_or(0, |_| 1) + + self.example.as_ref().map_or(0, |_| 1) + + self.exclusive_maximum.as_ref().map_or(0, |_| 1) + + self.exclusive_minimum.as_ref().map_or(0, |_| 1) + + self.external_docs.as_ref().map_or(0, |_| 1) + + self.format.as_ref().map_or(0, |_| 1) + + self.id.as_ref().map_or(0, |_| 1) + + self.items.as_ref().map_or(0, |_| 1) + + self.max_items.as_ref().map_or(0, |_| 1) + + self.max_length.as_ref().map_or(0, |_| 1) + + self.max_properties.as_ref().map_or(0, |_| 1) + + self.maximum.as_ref().map_or(0, |_| 1) + + self.min_items.as_ref().map_or(0, |_| 1) + + self.min_length.as_ref().map_or(0, |_| 1) + + self.min_properties.as_ref().map_or(0, |_| 1) + + self.minimum.as_ref().map_or(0, |_| 1) + + self.multiple_of.as_ref().map_or(0, |_| 1) + + self.not.as_ref().map_or(0, |_| 1) + + self.nullable.as_ref().map_or(0, |_| 1) + + self.one_of.as_ref().map_or(0, |_| 1) + + self.pattern.as_ref().map_or(0, |_| 1) + + self.pattern_properties.as_ref().map_or(0, |_| 1) + + self.properties.as_ref().map_or(0, |_| 1) + + self.required.as_ref().map_or(0, |_| 1) + + self.title.as_ref().map_or(0, |_| 1) + + self.type_.as_ref().map_or(0, |_| 1) + + self.unique_items.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_embedded_resource.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_int_or_string.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_list_map_keys.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_list_type.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_map_type.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_preserve_unknown_fields.as_ref().map_or(0, |_| 1) + + self.x_kubernetes_validations.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ref_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "$ref", value)?; + } + if let Some(value) = &self.schema { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "$schema", value)?; + } + if let Some(value) = &self.additional_items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "additionalItems", value)?; + } + if let Some(value) = &self.additional_properties { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "additionalProperties", value)?; + } + if let Some(value) = &self.all_of { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "allOf", value)?; + } + if let Some(value) = &self.any_of { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "anyOf", value)?; + } + if let Some(value) = &self.default { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "default", value)?; + } + if let Some(value) = &self.definitions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "definitions", value)?; + } + if let Some(value) = &self.dependencies { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dependencies", value)?; + } + if let Some(value) = &self.description { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "description", value)?; + } + if let Some(value) = &self.enum_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "enum", value)?; + } + if let Some(value) = &self.example { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "example", value)?; + } + if let Some(value) = &self.exclusive_maximum { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exclusiveMaximum", value)?; + } + if let Some(value) = &self.exclusive_minimum { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "exclusiveMinimum", value)?; + } + if let Some(value) = &self.external_docs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "externalDocs", value)?; + } + if let Some(value) = &self.format { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "format", value)?; + } + if let Some(value) = &self.id { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "id", value)?; + } + if let Some(value) = &self.items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", value)?; + } + if let Some(value) = &self.max_items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxItems", value)?; + } + if let Some(value) = &self.max_length { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxLength", value)?; + } + if let Some(value) = &self.max_properties { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maxProperties", value)?; + } + if let Some(value) = &self.maximum { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "maximum", value)?; + } + if let Some(value) = &self.min_items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minItems", value)?; + } + if let Some(value) = &self.min_length { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minLength", value)?; + } + if let Some(value) = &self.min_properties { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minProperties", value)?; + } + if let Some(value) = &self.minimum { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minimum", value)?; + } + if let Some(value) = &self.multiple_of { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "multipleOf", value)?; + } + if let Some(value) = &self.not { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "not", value)?; + } + if let Some(value) = &self.nullable { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nullable", value)?; + } + if let Some(value) = &self.one_of { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "oneOf", value)?; + } + if let Some(value) = &self.pattern { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "pattern", value)?; + } + if let Some(value) = &self.pattern_properties { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "patternProperties", value)?; + } + if let Some(value) = &self.properties { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "properties", value)?; + } + if let Some(value) = &self.required { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "required", value)?; + } + if let Some(value) = &self.title { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "title", value)?; + } + if let Some(value) = &self.type_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", value)?; + } + if let Some(value) = &self.unique_items { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uniqueItems", value)?; + } + if let Some(value) = &self.x_kubernetes_embedded_resource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-embedded-resource", value)?; + } + if let Some(value) = &self.x_kubernetes_int_or_string { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-int-or-string", value)?; + } + if let Some(value) = &self.x_kubernetes_list_map_keys { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-list-map-keys", value)?; + } + if let Some(value) = &self.x_kubernetes_list_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-list-type", value)?; + } + if let Some(value) = &self.x_kubernetes_map_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-map-type", value)?; + } + if let Some(value) = &self.x_kubernetes_preserve_unknown_fields { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-preserve-unknown-fields", value)?; + } + if let Some(value) = &self.x_kubernetes_validations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "x-kubernetes-validations", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JSONSchemaProps { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaProps".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "$ref".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "$schema".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "additionalItems".to_owned(), + __gen.subschema_for::(), + ), + ( + "additionalProperties".to_owned(), + __gen.subschema_for::(), + ), + ( + "allOf".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "anyOf".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "default".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("default is a default value for undefined object fields. Defaulting is a beta feature under the CustomResourceDefaulting feature gate. Defaulting requires spec.preserveUnknownFields to be false.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "definitions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "dependencies".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "description".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "enum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "example".to_owned(), + __gen.subschema_for::(), + ), + ( + "exclusiveMaximum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "exclusiveMinimum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "externalDocs".to_owned(), + __gen.subschema_for::(), + ), + ( + "format".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated:\n\n- bsonobjectid: a bson object ID, i.e. a 24 characters hex string - uri: an URI as parsed by Golang net/url.ParseRequestURI - email: an email address as parsed by Golang net/mail.ParseAddress - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. - ipv4: an IPv4 IP as parsed by Golang net.ParseIP - ipv6: an IPv6 IP as parsed by Golang net.ParseIP - cidr: a CIDR as parsed by Golang net.ParseCIDR - mac: a MAC address as parsed by Golang net.ParseMAC - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ - isbn: an ISBN10 or ISBN13 number string like \"0321751043\" or \"978-0321751041\" - isbn10: an ISBN10 number string like \"0321751043\" - isbn13: an ISBN13 number string like \"978-0321751041\" - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in - ssn: a U.S. social security number following the regex ^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$ - hexcolor: an hexadecimal color code like \"#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ - rgbcolor: an RGB color code like rgb like \"rgb(255,255,2559\" - byte: base64 encoded binary data - password: any kind of string - date: a date string like \"2006-01-02\" as defined by full-date in RFC3339 - duration: a duration string like \"22 ns\" as parsed by Golang time.ParseDuration or compatible with Scala duration format - datetime: a date time string like \"2014-12-15T19:30:20.000Z\" as defined by date-time in RFC3339.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "id".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "items".to_owned(), + __gen.subschema_for::(), + ), + ( + "maxItems".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "maxLength".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "maxProperties".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "maximum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Number))), + format: Some("double".to_owned()), + ..Default::default() + }), + ), + ( + "minItems".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "minLength".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "minProperties".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "minimum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Number))), + format: Some("double".to_owned()), + ..Default::default() + }), + ), + ( + "multipleOf".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Number))), + format: Some("double".to_owned()), + ..Default::default() + }), + ), + ( + "not".to_owned(), + __gen.subschema_for::(), + ), + ( + "nullable".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "oneOf".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "pattern".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "patternProperties".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "properties".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new(__gen.subschema_for::())), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "required".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "title".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uniqueItems".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "x-kubernetes-embedded-resource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-embedded-resource defines that the value is an embedded Kubernetes runtime.Object, with TypeMeta and ObjectMeta. The type must be object. It is allowed to further restrict the embedded object. kind, apiVersion and metadata are validated automatically. x-kubernetes-preserve-unknown-fields is allowed to be true, but does not have to be if the object is fully specified (up to kind, apiVersion, metadata).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "x-kubernetes-int-or-string".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-int-or-string specifies that this value is either an integer or a string. If this is true, an empty type is allowed and type as child of anyOf is permitted if following one of the following patterns:\n\n1) anyOf:\n - type: integer\n - type: string\n2) allOf:\n - anyOf:\n - type: integer\n - type: string\n - ... zero or more".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "x-kubernetes-list-map-keys".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used as the index of the map.\n\nThis tag MUST only be used on lists that have the \"x-kubernetes-list-type\" extension set to \"map\". Also, the values specified for this attribute must be a scalar typed field of the child structure (no nesting is supported).\n\nThe properties specified must either be required or have a default value, to ensure those properties are present for all list items.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "x-kubernetes-list-type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-list-type annotates an array to further describe its topology. This extension must only be used on lists and may have 3 possible values:\n\n1) `atomic`: the list is treated as a single entity, like a scalar.\n Atomic lists will be entirely replaced when updated. This extension\n may be used on any type of list (struct, scalar, ...).\n2) `set`:\n Sets are lists that must not have multiple items with the same value. Each\n value must be a scalar, an object with x-kubernetes-map-type `atomic` or an\n array with x-kubernetes-list-type `atomic`.\n3) `map`:\n These lists are like maps in that their elements have a non-index key\n used to identify them. Order is preserved upon merge. The map tag\n must only be used on a list with elements of type object.\nDefaults to atomic for arrays.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "x-kubernetes-map-type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-map-type annotates an object to further describe its topology. This extension must only be used when type is object and may have 2 possible values:\n\n1) `granular`:\n These maps are actual maps (key-value pairs) and each fields are independent\n from each other (they can each be manipulated by separate actors). This is\n the default behaviour for all maps.\n2) `atomic`: the list is treated as a single entity, like a scalar.\n Atomic maps will be entirely replaced when updated.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "x-kubernetes-preserve-unknown-fields".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-preserve-unknown-fields stops the API server decoding step from pruning fields which are not specified in the validation schema. This affects fields recursively, but switches back to normal pruning behaviour if nested properties or additionalProperties are specified in the schema. This can either be true or undefined. False is forbidden.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "x-kubernetes-validations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_array.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_array.rs new file mode 100644 index 000000000..29e24daf0 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_array.rs @@ -0,0 +1,78 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray + +/// JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes. +#[derive(Clone, Debug, PartialEq)] +pub enum JSONSchemaPropsOrArray { + Schema(Box), + Schemas(Vec), +} + +impl crate::DeepMerge for JSONSchemaPropsOrArray { + fn merge_from(&mut self, other: Self) { + *self = other; + } +} + +impl<'de> crate::serde::Deserialize<'de> for JSONSchemaPropsOrArray { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JSONSchemaPropsOrArray; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JSONSchemaPropsOrArray") + } + + fn visit_map(self, map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + Ok(JSONSchemaPropsOrArray::Schema(crate::serde::de::Deserialize::deserialize(crate::serde::de::value::MapAccessDeserializer::new(map))?)) + } + + fn visit_seq(self, seq: A) -> Result where A: crate::serde::de::SeqAccess<'de> { + Ok(JSONSchemaPropsOrArray::Schemas(crate::serde::de::Deserialize::deserialize(crate::serde::de::value::SeqAccessDeserializer::new(seq))?)) + } + } + + deserializer.deserialize_any(Visitor) + } +} + +impl crate::serde::Serialize for JSONSchemaPropsOrArray { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + match self { + JSONSchemaPropsOrArray::Schema(value) => value.serialize(serializer), + JSONSchemaPropsOrArray::Schemas(value) => value.serialize(serializer), + } + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JSONSchemaPropsOrArray { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrArray".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps or an array of JSONSchemaProps. Mainly here for serialization purposes.".to_owned()), + ..Default::default() + })), + subschemas: Some(Box::new(crate::schemars::schema::SubschemaValidation { + one_of: Some(vec![ + __gen.subschema_for::(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ]), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_bool.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_bool.rs new file mode 100644 index 000000000..dc5aab4cc --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_bool.rs @@ -0,0 +1,74 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool + +/// JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property. +#[derive(Clone, Debug, PartialEq)] +pub enum JSONSchemaPropsOrBool { + Schema(Box), + Bool(bool), +} + +impl crate::DeepMerge for JSONSchemaPropsOrBool { + fn merge_from(&mut self, other: Self) { + *self = other; + } +} + +impl<'de> crate::serde::Deserialize<'de> for JSONSchemaPropsOrBool { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JSONSchemaPropsOrBool; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JSONSchemaPropsOrBool") + } + + fn visit_map(self, map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + Ok(JSONSchemaPropsOrBool::Schema(crate::serde::de::Deserialize::deserialize(crate::serde::de::value::MapAccessDeserializer::new(map))?)) + } + + fn visit_bool(self, v: bool) -> Result where E: crate::serde::de::Error { + Ok(JSONSchemaPropsOrBool::Bool(v)) + } + } + + deserializer.deserialize_any(Visitor) + } +} + +impl crate::serde::Serialize for JSONSchemaPropsOrBool { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + match self { + JSONSchemaPropsOrBool::Schema(value) => value.serialize(serializer), + JSONSchemaPropsOrBool::Bool(value) => value.serialize(serializer), + } + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JSONSchemaPropsOrBool { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrBool".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value. Defaults to true for the boolean property.".to_owned()), + ..Default::default() + })), + subschemas: Some(Box::new(crate::schemars::schema::SubschemaValidation { + one_of: Some(vec![ + __gen.subschema_for::(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ]), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_string_array.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_string_array.rs new file mode 100644 index 000000000..16a729c7a --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/json_schema_props_or_string_array.rs @@ -0,0 +1,83 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray + +/// JSONSchemaPropsOrStringArray represents a JSONSchemaProps or a string array. +#[derive(Clone, Debug, PartialEq)] +pub enum JSONSchemaPropsOrStringArray { + Schema(Box), + Strings(Vec), +} + +impl crate::DeepMerge for JSONSchemaPropsOrStringArray { + fn merge_from(&mut self, other: Self) { + *self = other; + } +} + +impl<'de> crate::serde::Deserialize<'de> for JSONSchemaPropsOrStringArray { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = JSONSchemaPropsOrStringArray; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("JSONSchemaPropsOrStringArray") + } + + fn visit_map(self, map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + Ok(JSONSchemaPropsOrStringArray::Schema(crate::serde::de::Deserialize::deserialize(crate::serde::de::value::MapAccessDeserializer::new(map))?)) + } + + fn visit_seq(self, seq: A) -> Result where A: crate::serde::de::SeqAccess<'de> { + Ok(JSONSchemaPropsOrStringArray::Strings(crate::serde::de::Deserialize::deserialize(crate::serde::de::value::SeqAccessDeserializer::new(seq))?)) + } + } + + deserializer.deserialize_any(Visitor) + } +} + +impl crate::serde::Serialize for JSONSchemaPropsOrStringArray { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + match self { + JSONSchemaPropsOrStringArray::Schema(value) => value.serialize(serializer), + JSONSchemaPropsOrStringArray::Strings(value) => value.serialize(serializer), + } + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for JSONSchemaPropsOrStringArray { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.JSONSchemaPropsOrStringArray".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("JSONSchemaPropsOrStringArray represents a JSONSchemaProps or a string array.".to_owned()), + ..Default::default() + })), + subschemas: Some(Box::new(crate::schemars::schema::SubschemaValidation { + one_of: Some(vec![ + __gen.subschema_for::(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ))), + ..Default::default() + })), + ..Default::default() + }), + ]), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs new file mode 100644 index 000000000..d0a43ccc6 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/mod.rs @@ -0,0 +1,69 @@ + +mod custom_resource_column_definition; +pub use self::custom_resource_column_definition::CustomResourceColumnDefinition; + +mod custom_resource_conversion; +pub use self::custom_resource_conversion::CustomResourceConversion; + +mod custom_resource_definition; +pub use self::custom_resource_definition::CustomResourceDefinition; + +mod custom_resource_definition_condition; +pub use self::custom_resource_definition_condition::CustomResourceDefinitionCondition; + +mod custom_resource_definition_names; +pub use self::custom_resource_definition_names::CustomResourceDefinitionNames; + +mod custom_resource_definition_spec; +pub use self::custom_resource_definition_spec::CustomResourceDefinitionSpec; + +mod custom_resource_definition_status; +pub use self::custom_resource_definition_status::CustomResourceDefinitionStatus; + +mod custom_resource_definition_version; +pub use self::custom_resource_definition_version::CustomResourceDefinitionVersion; + +mod custom_resource_subresource_scale; +pub use self::custom_resource_subresource_scale::CustomResourceSubresourceScale; + +mod custom_resource_subresource_status; +pub use self::custom_resource_subresource_status::CustomResourceSubresourceStatus; + +mod custom_resource_subresources; +pub use self::custom_resource_subresources::CustomResourceSubresources; + +mod custom_resource_validation; +pub use self::custom_resource_validation::CustomResourceValidation; + +mod external_documentation; +pub use self::external_documentation::ExternalDocumentation; + +mod json; +pub use self::json::JSON; + +mod json_schema_props; +pub use self::json_schema_props::JSONSchemaProps; + +mod json_schema_props_or_array; +pub use self::json_schema_props_or_array::JSONSchemaPropsOrArray; + +mod json_schema_props_or_bool; +pub use self::json_schema_props_or_bool::JSONSchemaPropsOrBool; + +mod json_schema_props_or_string_array; +pub use self::json_schema_props_or_string_array::JSONSchemaPropsOrStringArray; + +mod selectable_field; +pub use self::selectable_field::SelectableField; + +mod service_reference; +pub use self::service_reference::ServiceReference; + +mod validation_rule; +pub use self::validation_rule::ValidationRule; + +mod webhook_client_config; +pub use self::webhook_client_config::WebhookClientConfig; + +mod webhook_conversion; +pub use self::webhook_conversion::WebhookConversion; diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/selectable_field.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/selectable_field.rs new file mode 100644 index 000000000..adf98dbc7 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/selectable_field.rs @@ -0,0 +1,128 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.SelectableField + +/// SelectableField specifies the JSON path of a field that may be used with field selectors. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SelectableField { + /// jsonPath is a simple JSON path which is evaluated against each custom resource to produce a field selector value. Only JSON paths without the array notation are allowed. Must point to a field of type string, boolean or integer. Types with enum values and strings with formats are allowed. If jsonPath refers to absent field in a resource, the jsonPath evaluates to an empty string. Must not point to metdata fields. Required. + pub json_path: String, +} + +impl crate::DeepMerge for SelectableField { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.json_path, other.json_path); + } +} + +impl<'de> crate::serde::Deserialize<'de> for SelectableField { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_json_path, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "jsonPath" => Field::Key_json_path, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = SelectableField; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("SelectableField") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_json_path: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_json_path => value_json_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(SelectableField { + json_path: value_json_path.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "SelectableField", + &[ + "jsonPath", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for SelectableField { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "SelectableField", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "jsonPath", &self.json_path)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for SelectableField { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.SelectableField".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("SelectableField specifies the JSON path of a field that may be used with field selectors.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "jsonPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("jsonPath is a simple JSON path which is evaluated against each custom resource to produce a field selector value. Only JSON paths without the array notation are allowed. Must point to a field of type string, boolean or integer. Types with enum values and strings with formats are allowed. If jsonPath refers to absent field in a resource, the jsonPath evaluates to an empty string. Must not point to metdata fields. Required.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "jsonPath".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/service_reference.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/service_reference.rs new file mode 100644 index 000000000..31207824e --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/service_reference.rs @@ -0,0 +1,202 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference + +/// ServiceReference holds a reference to Service.legacy.k8s.io +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceReference { + /// name is the name of the service. Required + pub name: String, + + /// namespace is the namespace of the service. Required + pub namespace: String, + + /// path is an optional URL path at which the webhook will be contacted. + pub path: Option, + + /// port is an optional service port at which the webhook will be contacted. `port` should be a valid port number (1-65535, inclusive). Defaults to 443 for backward compatibility. + pub port: Option, +} + +impl crate::DeepMerge for ServiceReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.path, other.path); + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_path, + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "path" => Field::Key_path, + "port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_path: Option = None; + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_path => value_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceReference { + name: value_name.unwrap_or_default(), + namespace: value_namespace.unwrap_or_default(), + path: value_path, + port: value_port, + }) + } + } + + deserializer.deserialize_struct( + "ServiceReference", + &[ + "name", + "namespace", + "path", + "port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceReference", + 2 + + self.path.as_ref().map_or(0, |_| 1) + + self.port.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", &self.namespace)?; + if let Some(value) = &self.path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "path", value)?; + } + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceReference { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ServiceReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceReference holds a reference to Service.legacy.k8s.io".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the service. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespace is the namespace of the service. Required".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "path".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("path is an optional URL path at which the webhook will be contacted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("port is an optional service port at which the webhook will be contacted. `port` should be a valid port number (1-65535, inclusive). Defaults to 443 for backward compatibility.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "namespace".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs new file mode 100644 index 000000000..a1ce15374 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/validation_rule.rs @@ -0,0 +1,291 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ValidationRule + +/// ValidationRule describes a validation rule written in the CEL expression language. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ValidationRule { + /// fieldPath represents the field path returned when the validation fails. It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` It does not support list numeric index. It supports child operation to refer to an existing field currently. Refer to \[JSONPath support in Kubernetes\](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. Numeric index of array is not supported. For field name which contains special characters, use `\['specialName'\]` to refer the field name. e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList\['foo.34$'\]` + pub field_path: Option, + + /// Message represents the message displayed when validation fails. The message is required if the Rule contains line breaks. The message must not contain line breaks. If unset, the message is "failed rule: {Rule}". e.g. "must be a URL with the host matching spec.host" + pub message: Option, + + /// MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a rule, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the rule; the only difference is the return type. Example: "x must be less than max ("+string(self.max)+")" + pub message_expression: Option, + + /// optionalOldSelf is used to opt a transition rule into evaluation even when the object is first created, or if the old object is missing the value. + /// + /// When enabled `oldSelf` will be a CEL optional whose value will be `None` if there is no old value, or when the object is initially created. + /// + /// You may check for presence of oldSelf using `oldSelf.hasValue()` and unwrap it after checking using `oldSelf.value()`. Check the CEL documentation for Optional types for more information: https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes + /// + /// May not be set unless `oldSelf` is used in `rule`. + pub optional_old_self: Option, + + /// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". If not set, default to use "FieldValueInvalid". All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. + pub reason: Option, + + /// Rule represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. The `self` variable in the CEL expression is bound to the scoped value. Example: - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual \<= self.spec.maxDesired"} + /// + /// If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as absent fields in CEL expressions. If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via `self\[mapKey\]`, map containment can be checked via `mapKey in self` and all entries of the map are accessible via CEL macros and functions such as `self.all(...)`. If the Rule is scoped to an array, the elements of the array are accessible via `self\[i\]` and also by macros and functions. If the Rule is scoped to a scalar, `self` is bound to the scalar value. Examples: - Rule scoped to a map of objects: {"rule": "self.components\['Widget'\].priority \< 10"} - Rule scoped to a list of integers: {"rule": "self.values.all(value, value \>= 0 && value \< 100)"} - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} + /// + /// The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. + /// + /// Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL expressions. This includes: - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: + /// - A schema with no type and x-kubernetes-preserve-unknown-fields set to true + /// - An array where the items schema is of an "unknown type" + /// - An object where the additionalProperties schema is of an "unknown type" + /// + /// Only property names of the form `\[a-zA-Z_.-/\]\[a-zA-Z0-9_.-/\]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + /// "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + /// "import", "let", "loop", "package", "namespace", "return". + /// Examples: + /// - Rule accessing a property named "namespace": {"rule": "self.__namespace__ \> 0"} + /// - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop \> 0"} + /// - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d \> 0"} + /// + /// Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. \[1, 2\] == \[2, 1\]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + /// - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + /// non-intersecting elements in `Y` are appended, retaining their partial order. + /// - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + /// are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + /// non-intersecting keys are appended, retaining their partial order. + /// + /// If `rule` makes use of the `oldSelf` variable it is implicitly a `transition rule`. + /// + /// By default, the `oldSelf` variable is the same type as `self`. When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional + /// variable whose value() is the same type as `self`. + /// See the documentation for the `optionalOldSelf` field for details. + /// + /// Transition rules by default are applied only on UPDATE requests and are skipped if an old value could not be found. You can opt a transition rule into unconditional evaluation by setting `optionalOldSelf` to true. + pub rule: String, +} + +impl crate::DeepMerge for ValidationRule { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field_path, other.field_path); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.message_expression, other.message_expression); + crate::DeepMerge::merge_from(&mut self.optional_old_self, other.optional_old_self); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.rule, other.rule); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ValidationRule { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field_path, + Key_message, + Key_message_expression, + Key_optional_old_self, + Key_reason, + Key_rule, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "fieldPath" => Field::Key_field_path, + "message" => Field::Key_message, + "messageExpression" => Field::Key_message_expression, + "optionalOldSelf" => Field::Key_optional_old_self, + "reason" => Field::Key_reason, + "rule" => Field::Key_rule, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ValidationRule; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ValidationRule") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field_path: Option = None; + let mut value_message: Option = None; + let mut value_message_expression: Option = None; + let mut value_optional_old_self: Option = None; + let mut value_reason: Option = None; + let mut value_rule: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field_path => value_field_path = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message_expression => value_message_expression = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_optional_old_self => value_optional_old_self = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_rule => value_rule = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ValidationRule { + field_path: value_field_path, + message: value_message, + message_expression: value_message_expression, + optional_old_self: value_optional_old_self, + reason: value_reason, + rule: value_rule.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ValidationRule", + &[ + "fieldPath", + "message", + "messageExpression", + "optionalOldSelf", + "reason", + "rule", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ValidationRule { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ValidationRule", + 1 + + self.field_path.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.message_expression.as_ref().map_or(0, |_| 1) + + self.optional_old_self.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.field_path { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldPath", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.message_expression { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "messageExpression", value)?; + } + if let Some(value) = &self.optional_old_self { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "optionalOldSelf", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rule", &self.rule)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ValidationRule { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ValidationRule".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ValidationRule describes a validation rule written in the CEL expression language.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "fieldPath".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("fieldPath represents the field path returned when the validation fails. It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` It does not support list numeric index. It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. Numeric index of array is not supported. For field name which contains special characters, use `['specialName']` to refer the field name. e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Message represents the message displayed when validation fails. The message is required if the Rule contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "messageExpression".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a rule, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the rule; the only difference is the return type. Example: \"x must be less than max (\"+string(self.max)+\")\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "optionalOldSelf".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("optionalOldSelf is used to opt a transition rule into evaluation even when the object is first created, or if the old object is missing the value.\n\nWhen enabled `oldSelf` will be a CEL optional whose value will be `None` if there is no old value, or when the object is initially created.\n\nYou may check for presence of oldSelf using `oldSelf.hasValue()` and unwrap it after checking using `oldSelf.value()`. Check the CEL documentation for Optional types for more information: https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes\n\nMay not be set unless `oldSelf` is used in `rule`.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. The currently supported reasons are: \"FieldValueInvalid\", \"FieldValueForbidden\", \"FieldValueRequired\", \"FieldValueDuplicate\". If not set, default to use \"FieldValueInvalid\". All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "rule".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Rule represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. The `self` variable in the CEL expression is bound to the scoped value. Example: - Rule scoped to the root of a resource with a status subresource: {\"rule\": \"self.status.actual <= self.spec.maxDesired\"}\n\nIf the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as absent fields in CEL expressions. If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map are accessible via CEL macros and functions such as `self.all(...)`. If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and functions. If the Rule is scoped to a scalar, `self` is bound to the scalar value. Examples: - Rule scoped to a map of objects: {\"rule\": \"self.components['Widget'].priority < 10\"} - Rule scoped to a list of integers: {\"rule\": \"self.values.all(value, value >= 0 && value < 100)\"} - Rule scoped to a string value: {\"rule\": \"self.startsWith('kube')\"}\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible.\n\nUnknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL expressions. This includes: - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. - Object properties where the property schema is of an \"unknown type\". An \"unknown type\" is recursively defined as:\n - A schema with no type and x-kubernetes-preserve-unknown-fields set to true\n - An array where the items schema is of an \"unknown type\"\n - An object where the additionalProperties schema is of an \"unknown type\"\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Rule accessing a property named \"namespace\": {\"rule\": \"self.__namespace__ > 0\"}\n - Rule accessing a property named \"x-prop\": {\"rule\": \"self.x__dash__prop > 0\"}\n - Rule accessing a property named \"redact__d\": {\"rule\": \"self.redact__underscores__d > 0\"}\n\nEquality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\n\nIf `rule` makes use of the `oldSelf` variable it is implicitly a `transition rule`.\n\nBy default, the `oldSelf` variable is the same type as `self`. When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional\n variable whose value() is the same type as `self`.\nSee the documentation for the `optionalOldSelf` field for details.\n\nTransition rules by default are applied only on UPDATE requests and are skipped if an old value could not be found. You can opt a transition rule into unconditional evaluation by setting `optionalOldSelf` to true.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "rule".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_client_config.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_client_config.rs new file mode 100644 index 000000000..82887d059 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_client_config.rs @@ -0,0 +1,190 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig + +/// WebhookClientConfig contains the information to make a TLS connection with the webhook. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct WebhookClientConfig { + /// caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. + pub ca_bundle: Option, + + /// service is a reference to the service for this webhook. Either service or url must be specified. + /// + /// If the webhook is running within the cluster, then you should use `service`. + pub service: Option, + + /// url gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. + /// + /// The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. + /// + /// Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. + /// + /// The scheme must be "https"; the URL must begin with "https://". + /// + /// A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. + /// + /// Attempting to use a user or basic auth e.g. "user:password@" is not allowed. Fragments ("#...") and query parameters ("?...") are not allowed, either. + pub url: Option, +} + +impl crate::DeepMerge for WebhookClientConfig { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ca_bundle, other.ca_bundle); + crate::DeepMerge::merge_from(&mut self.service, other.service); + crate::DeepMerge::merge_from(&mut self.url, other.url); + } +} + +impl<'de> crate::serde::Deserialize<'de> for WebhookClientConfig { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ca_bundle, + Key_service, + Key_url, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "caBundle" => Field::Key_ca_bundle, + "service" => Field::Key_service, + "url" => Field::Key_url, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WebhookClientConfig; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WebhookClientConfig") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ca_bundle: Option = None; + let mut value_service: Option = None; + let mut value_url: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ca_bundle => value_ca_bundle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_url => value_url = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(WebhookClientConfig { + ca_bundle: value_ca_bundle, + service: value_service, + url: value_url, + }) + } + } + + deserializer.deserialize_struct( + "WebhookClientConfig", + &[ + "caBundle", + "service", + "url", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for WebhookClientConfig { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WebhookClientConfig", + self.ca_bundle.as_ref().map_or(0, |_| 1) + + self.service.as_ref().map_or(0, |_| 1) + + self.url.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ca_bundle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "caBundle", value)?; + } + if let Some(value) = &self.service { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?; + } + if let Some(value) = &self.url { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "url", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WebhookClientConfig { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookClientConfig".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WebhookClientConfig contains the information to make a TLS connection with the webhook.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "caBundle".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }), + ), + ( + "service".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("service is a reference to the service for this webhook. Either service or url must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "url".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("url gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_conversion.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_conversion.rs new file mode 100644 index 000000000..69008b2dc --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/apiextensions/v1/webhook_conversion.rs @@ -0,0 +1,162 @@ +// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookConversion + +/// WebhookConversion describes how to call a conversion webhook +#[derive(Clone, Debug, Default, PartialEq)] +pub struct WebhookConversion { + /// clientConfig is the instructions for how to call the webhook if strategy is `Webhook`. + pub client_config: Option, + + /// conversionReviewVersions is an ordered list of preferred `ConversionReview` versions the Webhook expects. The API server will use the first version in the list which it supports. If none of the versions specified in this list are supported by API server, conversion will fail for the custom resource. If a persisted Webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail. + pub conversion_review_versions: Vec, +} + +impl crate::DeepMerge for WebhookConversion { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.client_config, other.client_config); + crate::merge_strategies::list::atomic(&mut self.conversion_review_versions, other.conversion_review_versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for WebhookConversion { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_client_config, + Key_conversion_review_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "clientConfig" => Field::Key_client_config, + "conversionReviewVersions" => Field::Key_conversion_review_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WebhookConversion; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WebhookConversion") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_client_config: Option = None; + let mut value_conversion_review_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_client_config => value_client_config = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_conversion_review_versions => value_conversion_review_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(WebhookConversion { + client_config: value_client_config, + conversion_review_versions: value_conversion_review_versions.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "WebhookConversion", + &[ + "clientConfig", + "conversionReviewVersions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for WebhookConversion { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WebhookConversion", + 1 + + self.client_config.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.client_config { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clientConfig", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conversionReviewVersions", &self.conversion_review_versions)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WebhookConversion { + fn schema_name() -> String { + "io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.WebhookConversion".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("WebhookConversion describes how to call a conversion webhook".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "clientConfig".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("clientConfig is the instructions for how to call the webhook if strategy is `Webhook`.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "conversionReviewVersions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("conversionReviewVersions is an ordered list of preferred `ConversionReview` versions the Webhook expects. The API server will use the first version in the list which it supports. If none of the versions specified in this list are supported by API server, conversion will fail for the custom resource. If a persisted Webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "conversionReviewVersions".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apiextensions_apiserver/pkg/apis/mod.rs b/src/v1_30/apiextensions_apiserver/pkg/apis/mod.rs new file mode 100644 index 000000000..c7af5e880 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod apiextensions; diff --git a/src/v1_30/apiextensions_apiserver/pkg/mod.rs b/src/v1_30/apiextensions_apiserver/pkg/mod.rs new file mode 100644 index 000000000..42354b599 --- /dev/null +++ b/src/v1_30/apiextensions_apiserver/pkg/mod.rs @@ -0,0 +1 @@ +pub mod apis; diff --git a/src/v1_30/apimachinery/mod.rs b/src/v1_30/apimachinery/mod.rs new file mode 100644 index 000000000..38fda62c1 --- /dev/null +++ b/src/v1_30/apimachinery/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_30/apimachinery/pkg/api/mod.rs b/src/v1_30/apimachinery/pkg/api/mod.rs new file mode 100644 index 000000000..c6bee0532 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/api/mod.rs @@ -0,0 +1 @@ +pub mod resource; diff --git a/src/v1_30/apimachinery/pkg/api/resource/mod.rs b/src/v1_30/apimachinery/pkg/api/resource/mod.rs new file mode 100644 index 000000000..629eeca5b --- /dev/null +++ b/src/v1_30/apimachinery/pkg/api/resource/mod.rs @@ -0,0 +1,3 @@ + +mod quantity; +pub use self::quantity::Quantity; diff --git a/src/v1_30/apimachinery/pkg/api/resource/quantity.rs b/src/v1_30/apimachinery/pkg/api/resource/quantity.rs new file mode 100644 index 000000000..fc5595f21 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/api/resource/quantity.rs @@ -0,0 +1,91 @@ +// Generated from definition io.k8s.apimachinery.pkg.api.resource.Quantity + +/// Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. +/// +/// The serialization format is: +/// +/// ``` \ ::= \\ +/// +/// (Note that \ may be empty, from the "" case in \.) +/// +/// \ ::= 0 | 1 | ... | 9 \ ::= \ | \\ \ ::= \ | \.\ | \. | .\ \ ::= "+" | "-" \ ::= \ | \\ \ ::= \ | \ | \ \ ::= Ki | Mi | Gi | Ti | Pi | Ei +/// +/// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) +/// +/// \ ::= m | "" | k | M | G | T | P | E +/// +/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) +/// +/// \ ::= "e" \ | "E" \ ``` +/// +/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. +/// +/// When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. +/// +/// Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: +/// +/// - No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible. +/// +/// The sign will be omitted unless the number is negative. +/// +/// Examples: +/// +/// - 1.5 will be serialized as "1500m" - 1.5Gi will be serialized as "1536Mi" +/// +/// Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. +/// +/// Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) +/// +/// This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Quantity(pub String); + +impl crate::DeepMerge for Quantity { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Quantity { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Quantity; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Quantity") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(Quantity(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("Quantity", Visitor) + } +} + +impl crate::serde::Serialize for Quantity { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("Quantity", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Quantity { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.api.resource.Quantity".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/mod.rs b/src/v1_30/apimachinery/pkg/apis/meta/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group.rs new file mode 100644 index 000000000..f83318ab0 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group.rs @@ -0,0 +1,260 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup + +/// APIGroup contains the name, the supported versions, and the preferred version of a group. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIGroup { + /// name is the name of the group. + pub name: String, + + /// preferredVersion is the version preferred by the API server, which probably is the storage version. + pub preferred_version: Option, + + /// a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP. + pub server_address_by_client_cidrs: Option>, + + /// versions are the versions supported in this group. + pub versions: Vec, +} + +impl crate::Resource for APIGroup { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "APIGroup"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = ""; + type Scope = crate::ClusterResourceScope; +} + +impl crate::DeepMerge for APIGroup { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.preferred_version, other.preferred_version); + crate::merge_strategies::list::atomic(&mut self.server_address_by_client_cidrs, other.server_address_by_client_cidrs); + crate::merge_strategies::list::atomic(&mut self.versions, other.versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIGroup { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_name, + Key_preferred_version, + Key_server_address_by_client_cidrs, + Key_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "preferredVersion" => Field::Key_preferred_version, + "serverAddressByClientCIDRs" => Field::Key_server_address_by_client_cidrs, + "versions" => Field::Key_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIGroup; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_preferred_version: Option = None; + let mut value_server_address_by_client_cidrs: Option> = None; + let mut value_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_preferred_version => value_preferred_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_server_address_by_client_cidrs => value_server_address_by_client_cidrs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_versions => value_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIGroup { + name: value_name.unwrap_or_default(), + preferred_version: value_preferred_version, + server_address_by_client_cidrs: value_server_address_by_client_cidrs, + versions: value_versions.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "name", + "preferredVersion", + "serverAddressByClientCIDRs", + "versions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIGroup { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4 + + self.preferred_version.as_ref().map_or(0, |_| 1) + + self.server_address_by_client_cidrs.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + if let Some(value) = &self.preferred_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preferredVersion", value)?; + } + if let Some(value) = &self.server_address_by_client_cidrs { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serverAddressByClientCIDRs", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "versions", &self.versions)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIGroup { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroup contains the name, the supported versions, and the preferred version of a group.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the name of the group.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "preferredVersion".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("preferredVersion is the version preferred by the API server, which probably is the storage version.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "serverAddressByClientCIDRs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "versions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("versions are the versions supported in this group.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "name".to_owned(), + "versions".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group_list.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group_list.rs new file mode 100644 index 000000000..e8a5d7e74 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_group_list.rs @@ -0,0 +1,183 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.APIGroupList + +/// APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIGroupList { + /// groups is a list of APIGroup. + pub groups: Vec, +} + +impl crate::Resource for APIGroupList { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "APIGroupList"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = ""; + type Scope = crate::ClusterResourceScope; +} + +impl crate::DeepMerge for APIGroupList { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.groups, other.groups); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIGroupList { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_groups, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "groups" => Field::Key_groups, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIGroupList; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_groups: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_groups => value_groups = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIGroupList { + groups: value_groups.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "groups", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIGroupList { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groups", &self.groups)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIGroupList { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.APIGroupList".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "groups".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("groups is a list of APIGroup.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "groups".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource.rs new file mode 100644 index 000000000..477c5ad98 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource.rs @@ -0,0 +1,372 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.APIResource + +/// APIResource specifies the name of a resource and whether it is namespaced. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIResource { + /// categories is a list of the grouped resources this resource belongs to (e.g. 'all') + pub categories: Option>, + + /// group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale". + pub group: Option, + + /// kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo') + pub kind: String, + + /// name is the plural name of the resource. + pub name: String, + + /// namespaced indicates if a resource is namespaced or not. + pub namespaced: bool, + + /// shortNames is a list of suggested short names of the resource. + pub short_names: Option>, + + /// singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface. + pub singular_name: String, + + /// The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates. + pub storage_version_hash: Option, + + /// verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy) + pub verbs: Vec, + + /// version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)". + pub version: Option, +} + +impl crate::DeepMerge for APIResource { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.categories, other.categories); + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespaced, other.namespaced); + crate::merge_strategies::list::atomic(&mut self.short_names, other.short_names); + crate::DeepMerge::merge_from(&mut self.singular_name, other.singular_name); + crate::DeepMerge::merge_from(&mut self.storage_version_hash, other.storage_version_hash); + crate::merge_strategies::list::atomic(&mut self.verbs, other.verbs); + crate::DeepMerge::merge_from(&mut self.version, other.version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIResource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_categories, + Key_group, + Key_kind, + Key_name, + Key_namespaced, + Key_short_names, + Key_singular_name, + Key_storage_version_hash, + Key_verbs, + Key_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "categories" => Field::Key_categories, + "group" => Field::Key_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "namespaced" => Field::Key_namespaced, + "shortNames" => Field::Key_short_names, + "singularName" => Field::Key_singular_name, + "storageVersionHash" => Field::Key_storage_version_hash, + "verbs" => Field::Key_verbs, + "version" => Field::Key_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIResource; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("APIResource") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_categories: Option> = None; + let mut value_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_namespaced: Option = None; + let mut value_short_names: Option> = None; + let mut value_singular_name: Option = None; + let mut value_storage_version_hash: Option = None; + let mut value_verbs: Option> = None; + let mut value_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_categories => value_categories = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespaced => value_namespaced = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_short_names => value_short_names = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_singular_name => value_singular_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_storage_version_hash => value_storage_version_hash = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_verbs => value_verbs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIResource { + categories: value_categories, + group: value_group, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + namespaced: value_namespaced.unwrap_or_default(), + short_names: value_short_names, + singular_name: value_singular_name.unwrap_or_default(), + storage_version_hash: value_storage_version_hash, + verbs: value_verbs.unwrap_or_default(), + version: value_version, + }) + } + } + + deserializer.deserialize_struct( + "APIResource", + &[ + "categories", + "group", + "kind", + "name", + "namespaced", + "shortNames", + "singularName", + "storageVersionHash", + "verbs", + "version", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIResource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "APIResource", + 5 + + self.categories.as_ref().map_or(0, |_| 1) + + self.group.as_ref().map_or(0, |_| 1) + + self.short_names.as_ref().map_or(0, |_| 1) + + self.storage_version_hash.as_ref().map_or(0, |_| 1) + + self.version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.categories { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "categories", value)?; + } + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespaced", &self.namespaced)?; + if let Some(value) = &self.short_names { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "shortNames", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "singularName", &self.singular_name)?; + if let Some(value) = &self.storage_version_hash { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageVersionHash", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "verbs", &self.verbs)?; + if let Some(value) = &self.version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIResource { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.APIResource".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIResource specifies the name of a resource and whether it is namespaced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "categories".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("categories is a list of the grouped resources this resource belongs to (e.g. 'all')".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("name is the plural name of the resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespaced".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("namespaced indicates if a resource is namespaced or not.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "shortNames".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("shortNames is a list of suggested short names of the resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "singularName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "storageVersionHash".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "verbs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "kind".to_owned(), + "name".to_owned(), + "namespaced".to_owned(), + "singularName".to_owned(), + "verbs".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource_list.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource_list.rs new file mode 100644 index 000000000..4107b4f48 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_resource_list.rs @@ -0,0 +1,206 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList + +/// APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIResourceList { + /// groupVersion is the group and version this APIResourceList is for. + pub group_version: String, + + /// resources contains the name of the resources and if they are namespaced. + pub resources: Vec, +} + +impl crate::Resource for APIResourceList { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "APIResourceList"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = ""; + type Scope = crate::ClusterResourceScope; +} + +impl crate::DeepMerge for APIResourceList { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group_version, other.group_version); + crate::merge_strategies::list::atomic(&mut self.resources, other.resources); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIResourceList { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_group_version, + Key_resources, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "groupVersion" => Field::Key_group_version, + "resources" => Field::Key_resources, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIResourceList; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group_version: Option = None; + let mut value_resources: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_group_version => value_group_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resources => value_resources = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIResourceList { + group_version: value_group_version.unwrap_or_default(), + resources: value_resources.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "groupVersion", + "resources", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIResourceList { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groupVersion", &self.group_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resources", &self.resources)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIResourceList { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "groupVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("groupVersion is the group and version this APIResourceList is for.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "resources".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("resources contains the name of the resources and if they are namespaced.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "groupVersion".to_owned(), + "resources".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/api_versions.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_versions.rs new file mode 100644 index 000000000..eda4a8978 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/api_versions.rs @@ -0,0 +1,215 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.APIVersions + +/// APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIVersions { + /// a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP. + pub server_address_by_client_cidrs: Vec, + + /// versions are the api versions that are available. + pub versions: Vec, +} + +impl crate::Resource for APIVersions { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "APIVersions"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = ""; + type Scope = crate::ClusterResourceScope; +} + +impl crate::DeepMerge for APIVersions { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.server_address_by_client_cidrs, other.server_address_by_client_cidrs); + crate::merge_strategies::list::atomic(&mut self.versions, other.versions); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIVersions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_server_address_by_client_cidrs, + Key_versions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "serverAddressByClientCIDRs" => Field::Key_server_address_by_client_cidrs, + "versions" => Field::Key_versions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIVersions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_server_address_by_client_cidrs: Option> = None; + let mut value_versions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_server_address_by_client_cidrs => value_server_address_by_client_cidrs = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_versions => value_versions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIVersions { + server_address_by_client_cidrs: value_server_address_by_client_cidrs.unwrap_or_default(), + versions: value_versions.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "serverAddressByClientCIDRs", + "versions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIVersions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serverAddressByClientCIDRs", &self.server_address_by_client_cidrs)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "versions", &self.versions)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIVersions { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.APIVersions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "serverAddressByClientCIDRs".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "versions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("versions are the api versions that are available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "serverAddressByClientCIDRs".to_owned(), + "versions".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/condition.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/condition.rs new file mode 100644 index 000000000..577427642 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/condition.rs @@ -0,0 +1,246 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.Condition + +/// Condition contains details for one aspect of the current state of this API Resource. +#[derive(Clone, Debug, PartialEq)] +pub struct Condition { + /// lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + pub last_transition_time: crate::apimachinery::pkg::apis::meta::v1::Time, + + /// message is a human readable message indicating details about the transition. This may be an empty string. + pub message: String, + + /// observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions\[x\].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + pub observed_generation: Option, + + /// reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + pub reason: String, + + /// status of the condition, one of True, False, Unknown. + pub status: String, + + /// type of condition in CamelCase or in foo.example.com/CamelCase. + pub type_: String, +} + +impl crate::DeepMerge for Condition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.observed_generation, other.observed_generation); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Condition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_observed_generation, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "observedGeneration" => Field::Key_observed_generation, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Condition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Condition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_observed_generation: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = Some(crate::serde::de::MapAccess::next_value(&mut map)?), + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_observed_generation => value_observed_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Condition { + last_transition_time: value_last_transition_time.ok_or_else(|| crate::serde::de::Error::missing_field("lastTransitionTime"))?, + message: value_message.unwrap_or_default(), + observed_generation: value_observed_generation, + reason: value_reason.unwrap_or_default(), + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Condition", + &[ + "lastTransitionTime", + "message", + "observedGeneration", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Condition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Condition", + 5 + + self.observed_generation.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", &self.last_transition_time)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", &self.message)?; + if let Some(value) = &self.observed_generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "observedGeneration", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", &self.reason)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Condition { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.Condition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Condition contains details for one aspect of the current state of this API Resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("message is a human readable message indicating details about the transition. This may be an empty string.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "observedGeneration".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("status of the condition, one of True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("type of condition in CamelCase or in foo.example.com/CamelCase.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "lastTransitionTime".to_owned(), + "message".to_owned(), + "reason".to_owned(), + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/delete_options.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/delete_options.rs new file mode 100644 index 000000000..4ac6d24fb --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/delete_options.rs @@ -0,0 +1,287 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions + +/// DeleteOptions may be provided when deleting an API object. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DeleteOptions { + /// 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 + pub api_version: Option, + + /// When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed + pub dry_run: Option>, + + /// The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. + pub grace_period_seconds: Option, + + /// 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 + pub kind: Option, + + /// Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. + pub orphan_dependents: Option, + + /// Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + pub preconditions: Option, + + /// Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. + pub propagation_policy: Option, +} + +impl crate::DeepMerge for DeleteOptions { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::merge_strategies::list::atomic(&mut self.dry_run, other.dry_run); + crate::DeepMerge::merge_from(&mut self.grace_period_seconds, other.grace_period_seconds); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.orphan_dependents, other.orphan_dependents); + crate::DeepMerge::merge_from(&mut self.preconditions, other.preconditions); + crate::DeepMerge::merge_from(&mut self.propagation_policy, other.propagation_policy); + } +} + +impl<'de> crate::serde::Deserialize<'de> for DeleteOptions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_dry_run, + Key_grace_period_seconds, + Key_kind, + Key_orphan_dependents, + Key_preconditions, + Key_propagation_policy, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "dryRun" => Field::Key_dry_run, + "gracePeriodSeconds" => Field::Key_grace_period_seconds, + "kind" => Field::Key_kind, + "orphanDependents" => Field::Key_orphan_dependents, + "preconditions" => Field::Key_preconditions, + "propagationPolicy" => Field::Key_propagation_policy, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = DeleteOptions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeleteOptions") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_dry_run: Option> = None; + let mut value_grace_period_seconds: Option = None; + let mut value_kind: Option = None; + let mut value_orphan_dependents: Option = None; + let mut value_preconditions: Option = None; + let mut value_propagation_policy: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_dry_run => value_dry_run = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_grace_period_seconds => value_grace_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_orphan_dependents => value_orphan_dependents = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_preconditions => value_preconditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_propagation_policy => value_propagation_policy = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(DeleteOptions { + api_version: value_api_version, + dry_run: value_dry_run, + grace_period_seconds: value_grace_period_seconds, + kind: value_kind, + orphan_dependents: value_orphan_dependents, + preconditions: value_preconditions, + propagation_policy: value_propagation_policy, + }) + } + } + + deserializer.deserialize_struct( + "DeleteOptions", + &[ + "apiVersion", + "dryRun", + "gracePeriodSeconds", + "kind", + "orphanDependents", + "preconditions", + "propagationPolicy", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for DeleteOptions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "DeleteOptions", + self.api_version.as_ref().map_or(0, |_| 1) + + self.dry_run.as_ref().map_or(0, |_| 1) + + self.grace_period_seconds.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1) + + self.orphan_dependents.as_ref().map_or(0, |_| 1) + + self.preconditions.as_ref().map_or(0, |_| 1) + + self.propagation_policy.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.dry_run { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "dryRun", value)?; + } + if let Some(value) = &self.grace_period_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gracePeriodSeconds", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + if let Some(value) = &self.orphan_dependents { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "orphanDependents", value)?; + } + if let Some(value) = &self.preconditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preconditions", value)?; + } + if let Some(value) = &self.propagation_policy { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "propagationPolicy", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for DeleteOptions { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeleteOptions may be provided when deleting an API object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "dryRun".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "gracePeriodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "orphanDependents".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "preconditions".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "propagationPolicy".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/fields_v1.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/fields_v1.rs new file mode 100644 index 000000000..51a376ce4 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/fields_v1.rs @@ -0,0 +1,59 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + +/// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format. +/// +/// Each key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:\', where \ is the name of a field in a struct, or key in a map 'v:\', where \ is the exact json formatted value of a list item 'i:\', where \ is position of a item in a list 'k:\', where \ is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set. +/// +/// The exact format is defined in sigs.k8s.io/structured-merge-diff +#[derive(Clone, Debug, Default, PartialEq)] +pub struct FieldsV1(pub crate::serde_json::Value); + +impl crate::DeepMerge for FieldsV1 { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for FieldsV1 { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = FieldsV1; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("FieldsV1") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(FieldsV1(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("FieldsV1", Visitor) + } +} + +impl crate::serde::Serialize for FieldsV1 { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("FieldsV1", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for FieldsV1 { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/group_version_for_discovery.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/group_version_for_discovery.rs new file mode 100644 index 000000000..eb5dc7f3b --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/group_version_for_discovery.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery + +/// GroupVersion contains the "group/version" and "version" string of a version. It is made a struct to keep extensibility. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct GroupVersionForDiscovery { + /// groupVersion specifies the API group and version in the form "group/version" + pub group_version: String, + + /// version specifies the version in the form of "version". This is to save the clients the trouble of splitting the GroupVersion. + pub version: String, +} + +impl crate::DeepMerge for GroupVersionForDiscovery { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.group_version, other.group_version); + crate::DeepMerge::merge_from(&mut self.version, other.version); + } +} + +impl<'de> crate::serde::Deserialize<'de> for GroupVersionForDiscovery { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_group_version, + Key_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "groupVersion" => Field::Key_group_version, + "version" => Field::Key_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = GroupVersionForDiscovery; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("GroupVersionForDiscovery") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_group_version: Option = None; + let mut value_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_group_version => value_group_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(GroupVersionForDiscovery { + group_version: value_group_version.unwrap_or_default(), + version: value_version.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "GroupVersionForDiscovery", + &[ + "groupVersion", + "version", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for GroupVersionForDiscovery { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "GroupVersionForDiscovery", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groupVersion", &self.group_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", &self.version)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for GroupVersionForDiscovery { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.GroupVersionForDiscovery".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "groupVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("groupVersion specifies the API group and version in the form \"group/version\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "groupVersion".to_owned(), + "version".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector.rs new file mode 100644 index 000000000..19028abb9 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector.rs @@ -0,0 +1,167 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + +/// A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LabelSelector { + /// matchExpressions is a list of label selector requirements. The requirements are ANDed. + pub match_expressions: Option>, + + /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + pub match_labels: Option>, +} + +impl crate::DeepMerge for LabelSelector { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.match_expressions, other.match_expressions); + crate::merge_strategies::map::granular(&mut self.match_labels, other.match_labels, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LabelSelector { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_match_expressions, + Key_match_labels, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "matchExpressions" => Field::Key_match_expressions, + "matchLabels" => Field::Key_match_labels, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LabelSelector; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LabelSelector") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_match_expressions: Option> = None; + let mut value_match_labels: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_match_expressions => value_match_expressions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_match_labels => value_match_labels = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LabelSelector { + match_expressions: value_match_expressions, + match_labels: value_match_labels, + }) + } + } + + deserializer.deserialize_struct( + "LabelSelector", + &[ + "matchExpressions", + "matchLabels", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LabelSelector { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LabelSelector", + self.match_expressions.as_ref().map_or(0, |_| 1) + + self.match_labels.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.match_expressions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchExpressions", value)?; + } + if let Some(value) = &self.match_labels { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "matchLabels", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LabelSelector { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "matchExpressions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchExpressions is a list of label selector requirements. The requirements are ANDed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "matchLabels".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector_requirement.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector_requirement.rs new file mode 100644 index 000000000..09c7dc7cc --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/label_selector_requirement.rs @@ -0,0 +1,185 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + +/// A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct LabelSelectorRequirement { + /// key is the label key that the selector applies to. + pub key: String, + + /// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + pub operator: String, + + /// values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + pub values: Option>, +} + +impl crate::DeepMerge for LabelSelectorRequirement { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.key, other.key); + crate::DeepMerge::merge_from(&mut self.operator, other.operator); + crate::merge_strategies::list::atomic(&mut self.values, other.values); + } +} + +impl<'de> crate::serde::Deserialize<'de> for LabelSelectorRequirement { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_key, + Key_operator, + Key_values, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "key" => Field::Key_key, + "operator" => Field::Key_operator, + "values" => Field::Key_values, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = LabelSelectorRequirement; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("LabelSelectorRequirement") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_key: Option = None; + let mut value_operator: Option = None; + let mut value_values: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_key => value_key = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operator => value_operator = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_values => value_values = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(LabelSelectorRequirement { + key: value_key.unwrap_or_default(), + operator: value_operator.unwrap_or_default(), + values: value_values, + }) + } + } + + deserializer.deserialize_struct( + "LabelSelectorRequirement", + &[ + "key", + "operator", + "values", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for LabelSelectorRequirement { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "LabelSelectorRequirement", + 2 + + self.values.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "key", &self.key)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operator", &self.operator)?; + if let Some(value) = &self.values { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "values", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for LabelSelectorRequirement { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "key".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("key is the label key that the selector applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operator".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "values".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + required: [ + "key".to_owned(), + "operator".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/list_meta.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/list_meta.rs new file mode 100644 index 000000000..726530b0d --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/list_meta.rs @@ -0,0 +1,203 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta + +/// ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ListMeta { + /// 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. + pub continue_: Option, + + /// 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. + pub remaining_item_count: Option, + + /// 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 + pub resource_version: Option, + + /// Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + pub self_link: Option, +} + +impl crate::DeepMerge for ListMeta { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.continue_, other.continue_); + crate::DeepMerge::merge_from(&mut self.remaining_item_count, other.remaining_item_count); + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + crate::DeepMerge::merge_from(&mut self.self_link, other.self_link); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ListMeta { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_continue_, + Key_remaining_item_count, + Key_resource_version, + Key_self_link, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "continue" => Field::Key_continue_, + "remainingItemCount" => Field::Key_remaining_item_count, + "resourceVersion" => Field::Key_resource_version, + "selfLink" => Field::Key_self_link, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ListMeta; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ListMeta") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_continue_: Option = None; + let mut value_remaining_item_count: Option = None; + let mut value_resource_version: Option = None; + let mut value_self_link: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_continue_ => value_continue_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_remaining_item_count => value_remaining_item_count = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_self_link => value_self_link = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ListMeta { + continue_: value_continue_, + remaining_item_count: value_remaining_item_count, + resource_version: value_resource_version, + self_link: value_self_link, + }) + } + } + + deserializer.deserialize_struct( + "ListMeta", + &[ + "continue", + "remainingItemCount", + "resourceVersion", + "selfLink", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ListMeta { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ListMeta", + self.continue_.as_ref().map_or(0, |_| 1) + + self.remaining_item_count.as_ref().map_or(0, |_| 1) + + self.resource_version.as_ref().map_or(0, |_| 1) + + self.self_link.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.continue_ { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "continue", value)?; + } + if let Some(value) = &self.remaining_item_count { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "remainingItemCount", value)?; + } + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + if let Some(value) = &self.self_link { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selfLink", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ListMeta { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "continue".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "remainingItemCount".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selfLink".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/managed_fields_entry.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/managed_fields_entry.rs new file mode 100644 index 000000000..c225336b9 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/managed_fields_entry.rs @@ -0,0 +1,277 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + +/// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ManagedFieldsEntry { + /// APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + pub api_version: Option, + + /// FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + pub fields_type: Option, + + /// FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + pub fields_v1: Option, + + /// Manager is an identifier of the workflow managing these fields. + pub manager: Option, + + /// Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + pub operation: Option, + + /// Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + pub subresource: Option, + + /// Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + pub time: Option, +} + +impl crate::DeepMerge for ManagedFieldsEntry { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.fields_type, other.fields_type); + crate::DeepMerge::merge_from(&mut self.fields_v1, other.fields_v1); + crate::DeepMerge::merge_from(&mut self.manager, other.manager); + crate::DeepMerge::merge_from(&mut self.operation, other.operation); + crate::DeepMerge::merge_from(&mut self.subresource, other.subresource); + crate::DeepMerge::merge_from(&mut self.time, other.time); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ManagedFieldsEntry { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_fields_type, + Key_fields_v1, + Key_manager, + Key_operation, + Key_subresource, + Key_time, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "fieldsType" => Field::Key_fields_type, + "fieldsV1" => Field::Key_fields_v1, + "manager" => Field::Key_manager, + "operation" => Field::Key_operation, + "subresource" => Field::Key_subresource, + "time" => Field::Key_time, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ManagedFieldsEntry; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ManagedFieldsEntry") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_fields_type: Option = None; + let mut value_fields_v1: Option = None; + let mut value_manager: Option = None; + let mut value_operation: Option = None; + let mut value_subresource: Option = None; + let mut value_time: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fields_type => value_fields_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_fields_v1 => value_fields_v1 = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_manager => value_manager = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_operation => value_operation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_subresource => value_subresource = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_time => value_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ManagedFieldsEntry { + api_version: value_api_version, + fields_type: value_fields_type, + fields_v1: value_fields_v1, + manager: value_manager, + operation: value_operation, + subresource: value_subresource, + time: value_time, + }) + } + } + + deserializer.deserialize_struct( + "ManagedFieldsEntry", + &[ + "apiVersion", + "fieldsType", + "fieldsV1", + "manager", + "operation", + "subresource", + "time", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ManagedFieldsEntry { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ManagedFieldsEntry", + self.api_version.as_ref().map_or(0, |_| 1) + + self.fields_type.as_ref().map_or(0, |_| 1) + + self.fields_v1.as_ref().map_or(0, |_| 1) + + self.manager.as_ref().map_or(0, |_| 1) + + self.operation.as_ref().map_or(0, |_| 1) + + self.subresource.as_ref().map_or(0, |_| 1) + + self.time.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.api_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", value)?; + } + if let Some(value) = &self.fields_type { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldsType", value)?; + } + if let Some(value) = &self.fields_v1 { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fieldsV1", value)?; + } + if let Some(value) = &self.manager { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "manager", value)?; + } + if let Some(value) = &self.operation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "operation", value)?; + } + if let Some(value) = &self.subresource { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "subresource", value)?; + } + if let Some(value) = &self.time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "time", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ManagedFieldsEntry { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fieldsType".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "fieldsV1".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "manager".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Manager is an identifier of the workflow managing these fields.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "operation".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "subresource".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "time".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/micro_time.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/micro_time.rs new file mode 100644 index 000000000..01cfa4b68 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/micro_time.rs @@ -0,0 +1,56 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.MicroTime + +/// MicroTime is version of Time with microsecond level precision. +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +pub struct MicroTime(pub crate::chrono::DateTime); + +impl crate::DeepMerge for MicroTime { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for MicroTime { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = MicroTime; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("MicroTime") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(MicroTime(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("MicroTime", Visitor) + } +} + +impl crate::serde::Serialize for MicroTime { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("MicroTime", &self.0.to_rfc3339_opts(chrono::SecondsFormat::Micros, true)) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for MicroTime { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.MicroTime".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("MicroTime is version of Time with microsecond level precision.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("date-time".to_owned()), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/mod.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/mod.rs new file mode 100644 index 000000000..942412758 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/mod.rs @@ -0,0 +1,72 @@ + +mod api_group; +pub use self::api_group::APIGroup; + +mod api_group_list; +pub use self::api_group_list::APIGroupList; + +mod api_resource; +pub use self::api_resource::APIResource; + +mod api_resource_list; +pub use self::api_resource_list::APIResourceList; + +mod api_versions; +pub use self::api_versions::APIVersions; + +mod condition; +pub use self::condition::Condition; + +mod delete_options; +pub use self::delete_options::DeleteOptions; + +mod fields_v1; +pub use self::fields_v1::FieldsV1; + +mod group_version_for_discovery; +pub use self::group_version_for_discovery::GroupVersionForDiscovery; + +mod label_selector; +pub use self::label_selector::LabelSelector; + +mod label_selector_requirement; +pub use self::label_selector_requirement::LabelSelectorRequirement; + +mod list_meta; +pub use self::list_meta::ListMeta; + +mod managed_fields_entry; +pub use self::managed_fields_entry::ManagedFieldsEntry; + +mod micro_time; +pub use self::micro_time::MicroTime; + +mod object_meta; +pub use self::object_meta::ObjectMeta; + +mod owner_reference; +pub use self::owner_reference::OwnerReference; + +mod patch; +pub use self::patch::Patch; + +mod preconditions; +pub use self::preconditions::Preconditions; + +mod server_address_by_client_cidr; +pub use self::server_address_by_client_cidr::ServerAddressByClientCIDR; + +mod status; +pub use self::status::Status; + +mod status_cause; +pub use self::status_cause::StatusCause; + +mod status_details; +pub use self::status_details::StatusDetails; + +mod time; +pub use self::time::Time; + +mod watch_event; +pub use self::watch_event::WatchEvent; diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/object_meta.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/object_meta.rs new file mode 100644 index 000000000..4685fe93e --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/object_meta.rs @@ -0,0 +1,539 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + +/// ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ObjectMeta { + /// Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + pub annotations: Option>, + + /// CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + /// + /// Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub creation_timestamp: Option, + + /// Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + pub deletion_grace_period_seconds: Option, + + /// DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + /// + /// Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub deletion_timestamp: Option, + + /// Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + pub finalizers: Option>, + + /// GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + /// + /// If this field is specified and the generated name exists, the server will return a 409. + /// + /// Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + pub generate_name: Option, + + /// A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + pub generation: Option, + + /// Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + pub labels: Option>, + + /// ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + pub managed_fields: Option>, + + /// Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + pub name: Option, + + /// Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + /// + /// Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + pub namespace: Option, + + /// List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + pub owner_references: Option>, + + /// An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + /// + /// Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + pub resource_version: Option, + + /// Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + pub self_link: Option, + + /// UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + /// + /// Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + pub uid: Option, +} + +impl crate::DeepMerge for ObjectMeta { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::map::granular(&mut self.annotations, other.annotations, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::DeepMerge::merge_from(&mut self.creation_timestamp, other.creation_timestamp); + crate::DeepMerge::merge_from(&mut self.deletion_grace_period_seconds, other.deletion_grace_period_seconds); + crate::DeepMerge::merge_from(&mut self.deletion_timestamp, other.deletion_timestamp); + crate::merge_strategies::list::set(&mut self.finalizers, other.finalizers); + crate::DeepMerge::merge_from(&mut self.generate_name, other.generate_name); + crate::DeepMerge::merge_from(&mut self.generation, other.generation); + crate::merge_strategies::map::granular(&mut self.labels, other.labels, |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }); + crate::merge_strategies::list::atomic(&mut self.managed_fields, other.managed_fields); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::merge_strategies::list::map( + &mut self.owner_references, + other.owner_references, + &[|lhs, rhs| lhs.uid == rhs.uid], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + crate::DeepMerge::merge_from(&mut self.self_link, other.self_link); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ObjectMeta { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_annotations, + Key_creation_timestamp, + Key_deletion_grace_period_seconds, + Key_deletion_timestamp, + Key_finalizers, + Key_generate_name, + Key_generation, + Key_labels, + Key_managed_fields, + Key_name, + Key_namespace, + Key_owner_references, + Key_resource_version, + Key_self_link, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "annotations" => Field::Key_annotations, + "creationTimestamp" => Field::Key_creation_timestamp, + "deletionGracePeriodSeconds" => Field::Key_deletion_grace_period_seconds, + "deletionTimestamp" => Field::Key_deletion_timestamp, + "finalizers" => Field::Key_finalizers, + "generateName" => Field::Key_generate_name, + "generation" => Field::Key_generation, + "labels" => Field::Key_labels, + "managedFields" => Field::Key_managed_fields, + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "ownerReferences" => Field::Key_owner_references, + "resourceVersion" => Field::Key_resource_version, + "selfLink" => Field::Key_self_link, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ObjectMeta; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectMeta") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_annotations: Option> = None; + let mut value_creation_timestamp: Option = None; + let mut value_deletion_grace_period_seconds: Option = None; + let mut value_deletion_timestamp: Option = None; + let mut value_finalizers: Option> = None; + let mut value_generate_name: Option = None; + let mut value_generation: Option = None; + let mut value_labels: Option> = None; + let mut value_managed_fields: Option> = None; + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_owner_references: Option> = None; + let mut value_resource_version: Option = None; + let mut value_self_link: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_annotations => value_annotations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_creation_timestamp => value_creation_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deletion_grace_period_seconds => value_deletion_grace_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_deletion_timestamp => value_deletion_timestamp = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_finalizers => value_finalizers = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_generate_name => value_generate_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_generation => value_generation = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_labels => value_labels = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_managed_fields => value_managed_fields = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_owner_references => value_owner_references = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_self_link => value_self_link = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ObjectMeta { + annotations: value_annotations, + creation_timestamp: value_creation_timestamp, + deletion_grace_period_seconds: value_deletion_grace_period_seconds, + deletion_timestamp: value_deletion_timestamp, + finalizers: value_finalizers, + generate_name: value_generate_name, + generation: value_generation, + labels: value_labels, + managed_fields: value_managed_fields, + name: value_name, + namespace: value_namespace, + owner_references: value_owner_references, + resource_version: value_resource_version, + self_link: value_self_link, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "ObjectMeta", + &[ + "annotations", + "creationTimestamp", + "deletionGracePeriodSeconds", + "deletionTimestamp", + "finalizers", + "generateName", + "generation", + "labels", + "managedFields", + "name", + "namespace", + "ownerReferences", + "resourceVersion", + "selfLink", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ObjectMeta { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectMeta", + self.annotations.as_ref().map_or(0, |_| 1) + + self.creation_timestamp.as_ref().map_or(0, |_| 1) + + self.deletion_grace_period_seconds.as_ref().map_or(0, |_| 1) + + self.deletion_timestamp.as_ref().map_or(0, |_| 1) + + self.finalizers.as_ref().map_or(0, |_| 1) + + self.generate_name.as_ref().map_or(0, |_| 1) + + self.generation.as_ref().map_or(0, |_| 1) + + self.labels.as_ref().map_or(0, |_| 1) + + self.managed_fields.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.owner_references.as_ref().map_or(0, |_| 1) + + self.resource_version.as_ref().map_or(0, |_| 1) + + self.self_link.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.annotations { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "annotations", value)?; + } + if let Some(value) = &self.creation_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "creationTimestamp", value)?; + } + if let Some(value) = &self.deletion_grace_period_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deletionGracePeriodSeconds", value)?; + } + if let Some(value) = &self.deletion_timestamp { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "deletionTimestamp", value)?; + } + if let Some(value) = &self.finalizers { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "finalizers", value)?; + } + if let Some(value) = &self.generate_name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "generateName", value)?; + } + if let Some(value) = &self.generation { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "generation", value)?; + } + if let Some(value) = &self.labels { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "labels", value)?; + } + if let Some(value) = &self.managed_fields { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "managedFields", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.owner_references { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ownerReferences", value)?; + } + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + if let Some(value) = &self.self_link { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selfLink", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ObjectMeta { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "annotations".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "creationTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "deletionGracePeriodSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "deletionTimestamp".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "finalizers".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + ))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "generateName".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "generation".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int64".to_owned()), + ..Default::default() + }), + ), + ( + "labels".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + additional_properties: Some(Box::new( + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }) + )), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "managedFields".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "ownerReferences".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "selfLink".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/owner_reference.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/owner_reference.rs new file mode 100644 index 000000000..4f0956999 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/owner_reference.rs @@ -0,0 +1,247 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + +/// OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct OwnerReference { + /// API version of the referent. + pub api_version: String, + + /// If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + pub block_owner_deletion: Option, + + /// If true, this reference points to the managing controller. + pub controller: Option, + + /// Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub kind: String, + + /// Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + pub name: String, + + /// UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + pub uid: String, +} + +impl crate::DeepMerge for OwnerReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.api_version, other.api_version); + crate::DeepMerge::merge_from(&mut self.block_owner_deletion, other.block_owner_deletion); + crate::DeepMerge::merge_from(&mut self.controller, other.controller); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for OwnerReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_block_owner_deletion, + Key_controller, + Key_kind, + Key_name, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "blockOwnerDeletion" => Field::Key_block_owner_deletion, + "controller" => Field::Key_controller, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = OwnerReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("OwnerReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_api_version: Option = None; + let mut value_block_owner_deletion: Option = None; + let mut value_controller: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => value_api_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_block_owner_deletion => value_block_owner_deletion = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_controller => value_controller = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(OwnerReference { + api_version: value_api_version.unwrap_or_default(), + block_owner_deletion: value_block_owner_deletion, + controller: value_controller, + kind: value_kind.unwrap_or_default(), + name: value_name.unwrap_or_default(), + uid: value_uid.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "OwnerReference", + &[ + "apiVersion", + "blockOwnerDeletion", + "controller", + "kind", + "name", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for OwnerReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "OwnerReference", + 4 + + self.block_owner_deletion.as_ref().map_or(0, |_| 1) + + self.controller.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", &self.api_version)?; + if let Some(value) = &self.block_owner_deletion { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "blockOwnerDeletion", value)?; + } + if let Some(value) = &self.controller { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "controller", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", &self.kind)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", &self.uid)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for OwnerReference { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("API version of the referent.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "blockOwnerDeletion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "controller".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If true, this reference points to the managing controller.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "apiVersion".to_owned(), + "kind".to_owned(), + "name".to_owned(), + "uid".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/patch.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/patch.rs new file mode 100644 index 000000000..19ce06144 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/patch.rs @@ -0,0 +1,37 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.Patch + +/// Patch is provided to give a concrete name and type to the Kubernetes PATCH request body. +#[derive(Clone, Debug, PartialEq)] +pub enum Patch { + Json(Vec), + Merge(crate::serde_json::Value), + StrategicMerge(crate::serde_json::Value), +} + +impl crate::serde::Serialize for Patch { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + match self { + Patch::Json(patch) => serializer.serialize_newtype_struct("Patch", patch), + Patch::Merge(patch) | + Patch::StrategicMerge(patch) => serializer.serialize_newtype_struct("Patch", patch), + } + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Patch { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.Patch".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/preconditions.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/preconditions.rs new file mode 100644 index 000000000..b87f240cf --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/preconditions.rs @@ -0,0 +1,152 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.Preconditions + +/// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Preconditions { + /// Specifies the target ResourceVersion + pub resource_version: Option, + + /// Specifies the target UID. + pub uid: Option, +} + +impl crate::DeepMerge for Preconditions { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Preconditions { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_resource_version, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "resourceVersion" => Field::Key_resource_version, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Preconditions; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Preconditions") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_resource_version: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Preconditions { + resource_version: value_resource_version, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "Preconditions", + &[ + "resourceVersion", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Preconditions { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Preconditions", + self.resource_version.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.resource_version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Preconditions { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.Preconditions".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "resourceVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the target ResourceVersion".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Specifies the target UID.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/server_address_by_client_cidr.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/server_address_by_client_cidr.rs new file mode 100644 index 000000000..50642ef29 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/server_address_by_client_cidr.rs @@ -0,0 +1,151 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR + +/// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServerAddressByClientCIDR { + /// The CIDR with which clients can match their IP to figure out the server address that they should use. + pub client_cidr: String, + + /// Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port. + pub server_address: String, +} + +impl crate::DeepMerge for ServerAddressByClientCIDR { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.client_cidr, other.client_cidr); + crate::DeepMerge::merge_from(&mut self.server_address, other.server_address); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServerAddressByClientCIDR { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_client_cidr, + Key_server_address, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "clientCIDR" => Field::Key_client_cidr, + "serverAddress" => Field::Key_server_address, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServerAddressByClientCIDR; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServerAddressByClientCIDR") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_client_cidr: Option = None; + let mut value_server_address: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_client_cidr => value_client_cidr = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_server_address => value_server_address = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServerAddressByClientCIDR { + client_cidr: value_client_cidr.unwrap_or_default(), + server_address: value_server_address.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "ServerAddressByClientCIDR", + &[ + "clientCIDR", + "serverAddress", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServerAddressByClientCIDR { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServerAddressByClientCIDR", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "clientCIDR", &self.client_cidr)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serverAddress", &self.server_address)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServerAddressByClientCIDR { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "clientCIDR".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The CIDR with which clients can match their IP to figure out the server address that they should use.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "serverAddress".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "clientCIDR".to_owned(), + "serverAddress".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/status.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/status.rs new file mode 100644 index 000000000..979f072bf --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/status.rs @@ -0,0 +1,317 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.Status + +/// Status is a return value for calls that don't return other objects. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Status { + /// Suggested HTTP return code for this status, 0 if not set. + pub code: Option, + + /// Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type. + pub details: Option, + + /// A human-readable description of the status of this operation. + pub message: Option, + + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ListMeta, + + /// A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it. + pub reason: Option, + + /// Status of the operation. One of: "Success" or "Failure". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + pub status: Option, +} + +impl crate::Resource for Status { + const API_VERSION: &'static str = "v1"; + const GROUP: &'static str = ""; + const KIND: &'static str = "Status"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "status"; + type Scope = crate::SubResourceScope; +} + +impl crate::Metadata for Status { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ListMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for Status { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.code, other.code); + crate::DeepMerge::merge_from(&mut self.details, other.details); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Status { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_code, + Key_details, + Key_message, + Key_metadata, + Key_reason, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "code" => Field::Key_code, + "details" => Field::Key_details, + "message" => Field::Key_message, + "metadata" => Field::Key_metadata, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Status; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_code: Option = None; + let mut value_details: Option = None; + let mut value_message: Option = None; + let mut value_metadata: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_code => value_code = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_details => value_details = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Status { + code: value_code, + details: value_details, + message: value_message, + metadata: value_metadata.unwrap_or_default(), + reason: value_reason, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "code", + "details", + "message", + "metadata", + "reason", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Status { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.code.as_ref().map_or(0, |_| 1) + + self.details.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + if let Some(value) = &self.code { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "code", value)?; + } + if let Some(value) = &self.details { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "details", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Status { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.Status".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is a return value for calls that don't return other objects.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "code".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Suggested HTTP return code for this status, 0 if not set.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "details".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human-readable description of the status of this operation.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/status_cause.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/status_cause.rs new file mode 100644 index 000000000..83b1407f7 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/status_cause.rs @@ -0,0 +1,181 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.StatusCause + +/// StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatusCause { + /// The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional. + /// + /// Examples: + /// "name" - the field "name" on the current resource + /// "items\[0\].name" - the field "name" on the first array entry in "items" + pub field: Option, + + /// A human-readable description of the cause of the error. This field may be presented as-is to a reader. + pub message: Option, + + /// A machine-readable description of the cause of the error. If this value is empty there is no information available. + pub reason: Option, +} + +impl crate::DeepMerge for StatusCause { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.field, other.field); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatusCause { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_field, + Key_message, + Key_reason, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "field" => Field::Key_field, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatusCause; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatusCause") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_field: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_field => value_field = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatusCause { + field: value_field, + message: value_message, + reason: value_reason, + }) + } + } + + deserializer.deserialize_struct( + "StatusCause", + &[ + "field", + "message", + "reason", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatusCause { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatusCause", + self.field.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.field { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "field", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatusCause { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.StatusCause".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "field".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A human-readable description of the cause of the error. This field may be presented as-is to a reader.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("A machine-readable description of the cause of the error. If this value is empty there is no information available.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/status_details.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/status_details.rs new file mode 100644 index 000000000..293d3d166 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/status_details.rs @@ -0,0 +1,257 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails + +/// 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. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct StatusDetails { + /// The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes. + pub causes: Option>, + + /// The group attribute of the resource associated with the status StatusReason. + pub group: Option, + + /// 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 + pub kind: Option, + + /// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described). + pub name: Option, + + /// 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. + pub retry_after_seconds: Option, + + /// 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 + pub uid: Option, +} + +impl crate::DeepMerge for StatusDetails { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::atomic(&mut self.causes, other.causes); + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.kind, other.kind); + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.retry_after_seconds, other.retry_after_seconds); + crate::DeepMerge::merge_from(&mut self.uid, other.uid); + } +} + +impl<'de> crate::serde::Deserialize<'de> for StatusDetails { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_causes, + Key_group, + Key_kind, + Key_name, + Key_retry_after_seconds, + Key_uid, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "causes" => Field::Key_causes, + "group" => Field::Key_group, + "kind" => Field::Key_kind, + "name" => Field::Key_name, + "retryAfterSeconds" => Field::Key_retry_after_seconds, + "uid" => Field::Key_uid, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = StatusDetails; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("StatusDetails") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_causes: Option> = None; + let mut value_group: Option = None; + let mut value_kind: Option = None; + let mut value_name: Option = None; + let mut value_retry_after_seconds: Option = None; + let mut value_uid: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_causes => value_causes = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_retry_after_seconds => value_retry_after_seconds = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(StatusDetails { + causes: value_causes, + group: value_group, + kind: value_kind, + name: value_name, + retry_after_seconds: value_retry_after_seconds, + uid: value_uid, + }) + } + } + + deserializer.deserialize_struct( + "StatusDetails", + &[ + "causes", + "group", + "kind", + "name", + "retryAfterSeconds", + "uid", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for StatusDetails { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "StatusDetails", + self.causes.as_ref().map_or(0, |_| 1) + + self.group.as_ref().map_or(0, |_| 1) + + self.kind.as_ref().map_or(0, |_| 1) + + self.name.as_ref().map_or(0, |_| 1) + + self.retry_after_seconds.as_ref().map_or(0, |_| 1) + + self.uid.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.causes { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "causes", value)?; + } + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + if let Some(value) = &self.kind { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?; + } + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.retry_after_seconds { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "retryAfterSeconds", value)?; + } + if let Some(value) = &self.uid { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for StatusDetails { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "causes".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The group attribute of the resource associated with the status StatusReason.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "retryAfterSeconds".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "uid".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/time.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/time.rs new file mode 100644 index 000000000..802d9addf --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/time.rs @@ -0,0 +1,56 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.Time + +/// Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +pub struct Time(pub crate::chrono::DateTime); + +impl crate::DeepMerge for Time { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Time { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Time; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Time") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(Time(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("Time", Visitor) + } +} + +impl crate::serde::Serialize for Time { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("Time", &self.0.to_rfc3339_opts(chrono::SecondsFormat::Secs, true)) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Time { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.Time".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("date-time".to_owned()), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/meta/v1/watch_event.rs b/src/v1_30/apimachinery/pkg/apis/meta/v1/watch_event.rs new file mode 100644 index 000000000..f0b885cb0 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/meta/v1/watch_event.rs @@ -0,0 +1,422 @@ +// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent + +/// Event represents a single event to a watched resource. +/// +/// Object is: +/// * If Type is Added or Modified: the new state of the object. +/// * If Type is Deleted: the state of the object immediately before deletion. +/// * If Type is Error: *Status is recommended; other types may make sense +/// depending on context. +#[derive(Clone, Debug, PartialEq)] +pub enum WatchEvent { + Added(T), + Deleted(T), + Modified(T), + Bookmark { + annotations: std::collections::BTreeMap, + resource_version: String, + }, + ErrorStatus(crate::apimachinery::pkg::apis::meta::v1::Status), + ErrorOther(crate::apimachinery::pkg::runtime::RawExtension), +} + +impl<'de, T> crate::serde::Deserialize<'de> for WatchEvent where T: crate::serde::Deserialize<'de> { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_type, + Key_object, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "type" => Field::Key_type, + "object" => Field::Key_object, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + enum WatchEventType { + Added, + Deleted, + Modified, + Bookmark, + Error, + } + + impl<'de> crate::serde::Deserialize<'de> for WatchEventType { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = WatchEventType; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("watch event type") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "ADDED" => WatchEventType::Added, + "DELETED" => WatchEventType::Deleted, + "MODIFIED" => WatchEventType::Modified, + "BOOKMARK" => WatchEventType::Bookmark, + "ERROR" => WatchEventType::Error, + _ => return Err(crate::serde::de::Error::unknown_variant( + v, + &["ADDED", "DELETED", "MODIFIED", "BOOKMARK", "ERROR"], + )), + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor(std::marker::PhantomData); + + impl<'de, T> crate::serde::de::Visitor<'de> for Visitor where T: crate::serde::Deserialize<'de> { + type Value = WatchEvent; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("WatchEvent") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_type: Option = None; + let mut value_object: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_type => value_type = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_object => value_object = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + let value_type = value_type.ok_or_else(|| crate::serde::de::Error::missing_field("type"))?; + let value_object = value_object.ok_or_else(|| crate::serde::de::Error::missing_field("object"))?; + + Ok(match value_type { + WatchEventType::Added => { + let value_object = crate::serde_value::ValueDeserializer::new(value_object); + WatchEvent::Added(crate::serde::Deserialize::deserialize(value_object)?) + }, + WatchEventType::Deleted => { + let value_object = crate::serde_value::ValueDeserializer::new(value_object); + WatchEvent::Deleted(crate::serde::Deserialize::deserialize(value_object)?) + }, + WatchEventType::Modified => { + let value_object = crate::serde_value::ValueDeserializer::new(value_object); + WatchEvent::Modified(crate::serde::Deserialize::deserialize(value_object)?) + }, + WatchEventType::Bookmark => { + let value_object = crate::serde_value::ValueDeserializer::new(value_object); + let value: BookmarkObject<'static> = crate::serde::Deserialize::deserialize(value_object)?; + WatchEvent::Bookmark { + annotations: value.metadata.annotations.into_owned(), + resource_version: value.metadata.resource_version.into_owned(), + } + }, + WatchEventType::Error => { + let is_status = + if let crate::serde_value::Value::Map(map) = &value_object { + matches!(map.get(&crate::serde_value::Value::String("kind".to_owned())), Some(crate::serde_value::Value::String(s)) if s == "Status") + } + else { + false + }; + let value_object = crate::serde_value::ValueDeserializer::new(value_object); + if is_status { + WatchEvent::ErrorStatus(crate::serde::Deserialize::deserialize(value_object)?) + } + else { + WatchEvent::ErrorOther(crate::serde::Deserialize::deserialize(value_object)?) + } + }, + }) + } + } + + deserializer.deserialize_struct( + "WatchEvent", + &[ + "type", + "object", + ], + Visitor(Default::default()), + ) + } +} + +impl crate::serde::Serialize for WatchEvent where T: crate::serde::Serialize { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "WatchEvent", + 2, + )?; + match self { + WatchEvent::Added(object) => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "ADDED")?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + WatchEvent::Deleted(object) => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "DELETED")?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + WatchEvent::Modified(object) => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "MODIFIED")?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + WatchEvent::Bookmark { annotations, resource_version } => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "BOOKMARK")?; + let object = BookmarkObject { + metadata: BookmarkObjectMeta { + annotations: std::borrow::Cow::Borrowed(annotations), + resource_version: std::borrow::Cow::Borrowed(&**resource_version), + }, + }; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + WatchEvent::ErrorStatus(object) => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "ERROR")?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + WatchEvent::ErrorOther(object) => { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", "ERROR")?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "object", &object)?; + }, + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[derive(Debug, PartialEq)] +struct BookmarkObject<'a> { + metadata: BookmarkObjectMeta<'a>, +} + +#[derive(Debug, PartialEq)] +struct BookmarkObjectMeta<'a> { + annotations: std::borrow::Cow<'a, std::collections::BTreeMap>, + resource_version: std::borrow::Cow<'a, str>, +} + +impl<'de> crate::serde::Deserialize<'de> for BookmarkObject<'static> { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_metadata, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "metadata" => Field::Key_metadata, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = BookmarkObject<'static>; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("BookmarkObject") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(BookmarkObject { + metadata: value_metadata.ok_or_else(|| crate::serde::de::Error::missing_field("metadata"))?, + }) + } + } + + deserializer.deserialize_struct( + "BookmarkObject", + &[ + "annotations", + "metadata", + ], + Visitor, + ) + } +} + +impl<'de> crate::serde::Deserialize<'de> for BookmarkObjectMeta<'static> { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_annotations, + Key_resource_version, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "annotations" => Field::Key_annotations, + "resourceVersion" => Field::Key_resource_version, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = BookmarkObjectMeta<'static>; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ObjectMeta") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_annotations: Option> = None; + let mut value_resource_version: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_annotations => value_annotations = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(BookmarkObjectMeta { + annotations: std::borrow::Cow::Owned(value_annotations.unwrap_or_default()), + resource_version: std::borrow::Cow::Owned(value_resource_version.ok_or_else(|| crate::serde::de::Error::missing_field("resourceVersion"))?), + }) + } + } + + deserializer.deserialize_struct( + "ObjectMeta", + &[ + "annotations", + "resourceVersion", + ], + Visitor, + ) + } +} + +impl<'a> crate::serde::Serialize for BookmarkObject<'a> { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "BookmarkObject", + 1, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +impl<'a> crate::serde::Serialize for BookmarkObjectMeta<'a> { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ObjectMeta", + 2, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "annotations", &self.annotations)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", &self.resource_version)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for WatchEvent { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Event represents a single event to a watched resource.\n\nObject is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.\n".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "object".to_owned(), + __gen.subschema_for::(), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "object".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/apis/mod.rs b/src/v1_30/apimachinery/pkg/apis/mod.rs new file mode 100644 index 000000000..6b50816f8 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod meta; diff --git a/src/v1_30/apimachinery/pkg/mod.rs b/src/v1_30/apimachinery/pkg/mod.rs new file mode 100644 index 000000000..99522b9af --- /dev/null +++ b/src/v1_30/apimachinery/pkg/mod.rs @@ -0,0 +1,9 @@ +pub mod api; + +pub mod apis; + +pub mod runtime; + +pub mod util; + +pub mod version; diff --git a/src/v1_30/apimachinery/pkg/runtime/mod.rs b/src/v1_30/apimachinery/pkg/runtime/mod.rs new file mode 100644 index 000000000..eb2b8c050 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/runtime/mod.rs @@ -0,0 +1,3 @@ + +mod raw_extension; +pub use self::raw_extension::RawExtension; diff --git a/src/v1_30/apimachinery/pkg/runtime/raw_extension.rs b/src/v1_30/apimachinery/pkg/runtime/raw_extension.rs new file mode 100644 index 000000000..4eee36e10 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/runtime/raw_extension.rs @@ -0,0 +1,92 @@ +// Generated from definition io.k8s.apimachinery.pkg.runtime.RawExtension + +/// RawExtension is used to hold extensions in external versions. +/// +/// To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types. +/// +/// // Internal package: +/// +/// type MyAPIObject struct { +/// runtime.TypeMeta `json:",inline"` +/// MyPlugin runtime.Object `json:"myPlugin"` +/// } +/// +/// type PluginA struct { +/// AOption string `json:"aOption"` +/// } +/// +/// // External package: +/// +/// type MyAPIObject struct { +/// runtime.TypeMeta `json:",inline"` +/// MyPlugin runtime.RawExtension `json:"myPlugin"` +/// } +/// +/// type PluginA struct { +/// AOption string `json:"aOption"` +/// } +/// +/// // On the wire, the JSON will look something like this: +/// +/// { +/// "kind":"MyAPIObject", +/// "apiVersion":"v1", +/// "myPlugin": { +/// "kind":"PluginA", +/// "aOption":"foo", +/// }, +/// } +/// +/// So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.) +#[derive(Clone, Debug, Default, PartialEq)] +pub struct RawExtension(pub crate::serde_json::Value); + +impl crate::DeepMerge for RawExtension { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.0, other.0); + } +} + +impl<'de> crate::serde::Deserialize<'de> for RawExtension { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = RawExtension; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("RawExtension") + } + + fn visit_newtype_struct(self, deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + Ok(RawExtension(crate::serde::Deserialize::deserialize(deserializer)?)) + } + } + + deserializer.deserialize_newtype_struct("RawExtension", Visitor) + } +} + +impl crate::serde::Serialize for RawExtension { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + serializer.serialize_newtype_struct("RawExtension", &self.0) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for RawExtension { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.runtime.RawExtension".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/util/intstr/int_or_string.rs b/src/v1_30/apimachinery/pkg/util/intstr/int_or_string.rs new file mode 100644 index 000000000..d0f503506 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/util/intstr/int_or_string.rs @@ -0,0 +1,87 @@ +// Generated from definition io.k8s.apimachinery.pkg.util.intstr.IntOrString + +/// IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum IntOrString { + Int(i32), + String(String), +} + +impl Default for IntOrString { + fn default() -> Self { + IntOrString::Int(0) + } +} + +impl crate::DeepMerge for IntOrString { + fn merge_from(&mut self, other: Self) { + *self = other; + } +} + +impl<'de> crate::serde::Deserialize<'de> for IntOrString { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = IntOrString; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("IntOrString") + } + + fn visit_i32(self, v: i32) -> Result where E: crate::serde::de::Error { + Ok(IntOrString::Int(v)) + } + + fn visit_i64(self, v: i64) -> Result where E: crate::serde::de::Error { + let v = v.try_into().map_err(|_| crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Signed(v), &"a 32-bit integer"))?; + Ok(IntOrString::Int(v)) + } + + fn visit_u64(self, v: u64) -> Result where E: crate::serde::de::Error { + let v = v.try_into().map_err(|_| crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Unsigned(v), &"a 32-bit integer"))?; + Ok(IntOrString::Int(v)) + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + self.visit_string(v.to_owned()) + } + + fn visit_string(self, v: String) -> Result where E: crate::serde::de::Error { + Ok(IntOrString::String(v)) + } + } + + deserializer.deserialize_any(Visitor) + } +} + +impl crate::serde::Serialize for IntOrString { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + match self { + IntOrString::Int(i) => i.serialize(serializer), + IntOrString::String(s) => s.serialize(serializer), + } + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for IntOrString { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.util.intstr.IntOrString".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.".to_owned()), + ..Default::default() + })), + extensions: [ + ("x-kubernetes-int-or-string".to_owned(), crate::serde_json::Value::Bool(true)), + ].into(), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/util/intstr/mod.rs b/src/v1_30/apimachinery/pkg/util/intstr/mod.rs new file mode 100644 index 000000000..d3f719612 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/util/intstr/mod.rs @@ -0,0 +1,3 @@ + +mod int_or_string; +pub use self::int_or_string::IntOrString; diff --git a/src/v1_30/apimachinery/pkg/util/mod.rs b/src/v1_30/apimachinery/pkg/util/mod.rs new file mode 100644 index 000000000..a1d5337d0 --- /dev/null +++ b/src/v1_30/apimachinery/pkg/util/mod.rs @@ -0,0 +1 @@ +pub mod intstr; diff --git a/src/v1_30/apimachinery/pkg/version/info.rs b/src/v1_30/apimachinery/pkg/version/info.rs new file mode 100644 index 000000000..6a666fbec --- /dev/null +++ b/src/v1_30/apimachinery/pkg/version/info.rs @@ -0,0 +1,267 @@ +// Generated from definition io.k8s.apimachinery.pkg.version.Info + +/// Info contains versioning information. how we'll want to distribute that information. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Info { + pub build_date: String, + + pub compiler: String, + + pub git_commit: String, + + pub git_tree_state: String, + + pub git_version: String, + + pub go_version: String, + + pub major: String, + + pub minor: String, + + pub platform: String, +} + +impl crate::DeepMerge for Info { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.build_date, other.build_date); + crate::DeepMerge::merge_from(&mut self.compiler, other.compiler); + crate::DeepMerge::merge_from(&mut self.git_commit, other.git_commit); + crate::DeepMerge::merge_from(&mut self.git_tree_state, other.git_tree_state); + crate::DeepMerge::merge_from(&mut self.git_version, other.git_version); + crate::DeepMerge::merge_from(&mut self.go_version, other.go_version); + crate::DeepMerge::merge_from(&mut self.major, other.major); + crate::DeepMerge::merge_from(&mut self.minor, other.minor); + crate::DeepMerge::merge_from(&mut self.platform, other.platform); + } +} + +impl<'de> crate::serde::Deserialize<'de> for Info { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_build_date, + Key_compiler, + Key_git_commit, + Key_git_tree_state, + Key_git_version, + Key_go_version, + Key_major, + Key_minor, + Key_platform, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "buildDate" => Field::Key_build_date, + "compiler" => Field::Key_compiler, + "gitCommit" => Field::Key_git_commit, + "gitTreeState" => Field::Key_git_tree_state, + "gitVersion" => Field::Key_git_version, + "goVersion" => Field::Key_go_version, + "major" => Field::Key_major, + "minor" => Field::Key_minor, + "platform" => Field::Key_platform, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Info; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Info") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_build_date: Option = None; + let mut value_compiler: Option = None; + let mut value_git_commit: Option = None; + let mut value_git_tree_state: Option = None; + let mut value_git_version: Option = None; + let mut value_go_version: Option = None; + let mut value_major: Option = None; + let mut value_minor: Option = None; + let mut value_platform: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_build_date => value_build_date = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_compiler => value_compiler = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_git_commit => value_git_commit = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_git_tree_state => value_git_tree_state = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_git_version => value_git_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_go_version => value_go_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_major => value_major = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_minor => value_minor = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_platform => value_platform = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(Info { + build_date: value_build_date.unwrap_or_default(), + compiler: value_compiler.unwrap_or_default(), + git_commit: value_git_commit.unwrap_or_default(), + git_tree_state: value_git_tree_state.unwrap_or_default(), + git_version: value_git_version.unwrap_or_default(), + go_version: value_go_version.unwrap_or_default(), + major: value_major.unwrap_or_default(), + minor: value_minor.unwrap_or_default(), + platform: value_platform.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "Info", + &[ + "buildDate", + "compiler", + "gitCommit", + "gitTreeState", + "gitVersion", + "goVersion", + "major", + "minor", + "platform", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for Info { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "Info", + 9, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "buildDate", &self.build_date)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "compiler", &self.compiler)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitCommit", &self.git_commit)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitTreeState", &self.git_tree_state)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitVersion", &self.git_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "goVersion", &self.go_version)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "major", &self.major)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "minor", &self.minor)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "platform", &self.platform)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for Info { + fn schema_name() -> String { + "io.k8s.apimachinery.pkg.version.Info".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Info contains versioning information. how we'll want to distribute that information.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "buildDate".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "compiler".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gitCommit".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gitTreeState".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "gitVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "goVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "major".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "minor".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "platform".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "buildDate".to_owned(), + "compiler".to_owned(), + "gitCommit".to_owned(), + "gitTreeState".to_owned(), + "gitVersion".to_owned(), + "goVersion".to_owned(), + "major".to_owned(), + "minor".to_owned(), + "platform".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/apimachinery/pkg/version/mod.rs b/src/v1_30/apimachinery/pkg/version/mod.rs new file mode 100644 index 000000000..f125e577d --- /dev/null +++ b/src/v1_30/apimachinery/pkg/version/mod.rs @@ -0,0 +1,3 @@ + +mod info; +pub use self::info::Info; diff --git a/src/v1_30/kube_aggregator/mod.rs b/src/v1_30/kube_aggregator/mod.rs new file mode 100644 index 000000000..38fda62c1 --- /dev/null +++ b/src/v1_30/kube_aggregator/mod.rs @@ -0,0 +1 @@ +pub mod pkg; diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/mod.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/mod.rs new file mode 100644 index 000000000..a3a6d96c3 --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs new file mode 100644 index 000000000..2496a52cf --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service.rs @@ -0,0 +1,245 @@ +// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService + +/// APIService represents a server for a particular GroupVersion. Name must be "version.group". +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIService { + /// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta, + + /// Spec contains information for locating and communicating with a server + pub spec: Option, + + /// Status contains derived information about an API server + pub status: Option, +} + +impl crate::Resource for APIService { + const API_VERSION: &'static str = "apiregistration.k8s.io/v1"; + const GROUP: &'static str = "apiregistration.k8s.io"; + const KIND: &'static str = "APIService"; + const VERSION: &'static str = "v1"; + const URL_PATH_SEGMENT: &'static str = "apiservices"; + type Scope = crate::ClusterResourceScope; +} + +impl crate::ListableResource for APIService { + const LIST_KIND: &'static str = "APIServiceList"; +} + +impl crate::Metadata for APIService { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for APIService { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + crate::DeepMerge::merge_from(&mut self.spec, other.spec); + crate::DeepMerge::merge_from(&mut self.status, other.status); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIService { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_metadata, + Key_spec, + Key_status, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "metadata" => Field::Key_metadata, + "spec" => Field::Key_spec, + "status" => Field::Key_status, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIService; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_metadata: Option = None; + let mut value_spec: Option = None; + let mut value_status: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIService { + metadata: value_metadata.unwrap_or_default(), + spec: value_spec, + status: value_status, + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "metadata", + "spec", + "status", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIService { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 3 + + self.spec.as_ref().map_or(0, |_| 1) + + self.status.as_ref().map_or(0, |_| 1), + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + if let Some(value) = &self.spec { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?; + } + if let Some(value) = &self.status { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIService { + fn schema_name() -> String { + "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIService represents a server for a particular GroupVersion. Name must be \"version.group\".".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "apiVersion".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "kind".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + 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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "metadata".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "spec".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Spec contains information for locating and communicating with a server".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "status".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status contains derived information about an API server".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ].into(), + required: [ + "metadata".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_condition.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_condition.rs new file mode 100644 index 000000000..8c70ff0ac --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_condition.rs @@ -0,0 +1,226 @@ +// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceCondition + +/// APIServiceCondition describes the state of an APIService at a particular point +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIServiceCondition { + /// Last time the condition transitioned from one status to another. + pub last_transition_time: Option, + + /// Human-readable message indicating details about last transition. + pub message: Option, + + /// Unique, one-word, CamelCase reason for the condition's last transition. + pub reason: Option, + + /// Status is the status of the condition. Can be True, False, Unknown. + pub status: String, + + /// Type is the type of the condition. + pub type_: String, +} + +impl crate::DeepMerge for APIServiceCondition { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.last_transition_time, other.last_transition_time); + crate::DeepMerge::merge_from(&mut self.message, other.message); + crate::DeepMerge::merge_from(&mut self.reason, other.reason); + crate::DeepMerge::merge_from(&mut self.status, other.status); + crate::DeepMerge::merge_from(&mut self.type_, other.type_); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIServiceCondition { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_last_transition_time, + Key_message, + Key_reason, + Key_status, + Key_type_, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "lastTransitionTime" => Field::Key_last_transition_time, + "message" => Field::Key_message, + "reason" => Field::Key_reason, + "status" => Field::Key_status, + "type" => Field::Key_type_, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIServiceCondition; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("APIServiceCondition") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_last_transition_time: Option = None; + let mut value_message: Option = None; + let mut value_reason: Option = None; + let mut value_status: Option = None; + let mut value_type_: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_last_transition_time => value_last_transition_time = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_message => value_message = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_reason => value_reason = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_type_ => value_type_ = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIServiceCondition { + last_transition_time: value_last_transition_time, + message: value_message, + reason: value_reason, + status: value_status.unwrap_or_default(), + type_: value_type_.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "APIServiceCondition", + &[ + "lastTransitionTime", + "message", + "reason", + "status", + "type", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIServiceCondition { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "APIServiceCondition", + 2 + + self.last_transition_time.as_ref().map_or(0, |_| 1) + + self.message.as_ref().map_or(0, |_| 1) + + self.reason.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.last_transition_time { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "lastTransitionTime", value)?; + } + if let Some(value) = &self.message { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "message", value)?; + } + if let Some(value) = &self.reason { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "reason", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "type", &self.type_)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIServiceCondition { + fn schema_name() -> String { + "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceCondition".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIServiceCondition describes the state of an APIService at a particular point".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "lastTransitionTime".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Last time the condition transitioned from one status to another.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "message".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Human-readable message indicating details about last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "reason".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Unique, one-word, CamelCase reason for the condition's last transition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "status".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Status is the status of the condition. Can be True, False, Unknown.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "type".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Type is the type of the condition.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ].into(), + required: [ + "status".to_owned(), + "type".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_spec.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_spec.rs new file mode 100644 index 000000000..fe03e8042 --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_spec.rs @@ -0,0 +1,279 @@ +// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceSpec + +/// APIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIServiceSpec { + /// 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. + pub ca_bundle: Option, + + /// Group is the API group name this server hosts + pub group: Option, + + /// 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 + pub group_priority_minimum: i32, + + /// InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead. + pub insecure_skip_tls_verify: Option, + + /// 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. + pub service: Option, + + /// Version is the API version this server hosts. For example, "v1" + pub version: Option, + + /// 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. + pub version_priority: i32, +} + +impl crate::DeepMerge for APIServiceSpec { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.ca_bundle, other.ca_bundle); + crate::DeepMerge::merge_from(&mut self.group, other.group); + crate::DeepMerge::merge_from(&mut self.group_priority_minimum, other.group_priority_minimum); + crate::DeepMerge::merge_from(&mut self.insecure_skip_tls_verify, other.insecure_skip_tls_verify); + crate::DeepMerge::merge_from(&mut self.service, other.service); + crate::DeepMerge::merge_from(&mut self.version, other.version); + crate::DeepMerge::merge_from(&mut self.version_priority, other.version_priority); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIServiceSpec { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_ca_bundle, + Key_group, + Key_group_priority_minimum, + Key_insecure_skip_tls_verify, + Key_service, + Key_version, + Key_version_priority, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "caBundle" => Field::Key_ca_bundle, + "group" => Field::Key_group, + "groupPriorityMinimum" => Field::Key_group_priority_minimum, + "insecureSkipTLSVerify" => Field::Key_insecure_skip_tls_verify, + "service" => Field::Key_service, + "version" => Field::Key_version, + "versionPriority" => Field::Key_version_priority, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIServiceSpec; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("APIServiceSpec") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_ca_bundle: Option = None; + let mut value_group: Option = None; + let mut value_group_priority_minimum: Option = None; + let mut value_insecure_skip_tls_verify: Option = None; + let mut value_service: Option = None; + let mut value_version: Option = None; + let mut value_version_priority: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_ca_bundle => value_ca_bundle = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_group_priority_minimum => value_group_priority_minimum = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_insecure_skip_tls_verify => value_insecure_skip_tls_verify = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_version_priority => value_version_priority = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIServiceSpec { + ca_bundle: value_ca_bundle, + group: value_group, + group_priority_minimum: value_group_priority_minimum.unwrap_or_default(), + insecure_skip_tls_verify: value_insecure_skip_tls_verify, + service: value_service, + version: value_version, + version_priority: value_version_priority.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + "APIServiceSpec", + &[ + "caBundle", + "group", + "groupPriorityMinimum", + "insecureSkipTLSVerify", + "service", + "version", + "versionPriority", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIServiceSpec { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "APIServiceSpec", + 2 + + self.ca_bundle.as_ref().map_or(0, |_| 1) + + self.group.as_ref().map_or(0, |_| 1) + + self.insecure_skip_tls_verify.as_ref().map_or(0, |_| 1) + + self.service.as_ref().map_or(0, |_| 1) + + self.version.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.ca_bundle { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "caBundle", value)?; + } + if let Some(value) = &self.group { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groupPriorityMinimum", &self.group_priority_minimum)?; + if let Some(value) = &self.insecure_skip_tls_verify { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "insecureSkipTLSVerify", value)?; + } + if let Some(value) = &self.service { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?; + } + if let Some(value) = &self.version { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?; + } + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "versionPriority", &self.version_priority)?; + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIServiceSpec { + fn schema_name() -> String { + "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceSpec".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "caBundle".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + format: Some("byte".to_owned()), + ..Default::default() + }), + ), + ( + "group".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Group is the API group name this server hosts".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "groupPriorityMinimum".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ( + "insecureSkipTLSVerify".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Boolean))), + ..Default::default() + }), + ), + ( + "service".to_owned(), + { + let mut schema_obj = __gen.subschema_for::().into_object(); + schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })); + crate::schemars::schema::Schema::Object(schema_obj) + }, + ), + ( + "version".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Version is the API version this server hosts. For example, \"v1\"".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "versionPriority".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("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.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + required: [ + "groupPriorityMinimum".to_owned(), + "versionPriority".to_owned(), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs new file mode 100644 index 000000000..72a107b6b --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/api_service_status.rs @@ -0,0 +1,138 @@ +// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceStatus + +/// APIServiceStatus contains derived information about an API server +#[derive(Clone, Debug, Default, PartialEq)] +pub struct APIServiceStatus { + /// Current service state of apiService. + pub conditions: Option>, +} + +impl crate::DeepMerge for APIServiceStatus { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.conditions, + other.conditions, + &[|lhs, rhs| lhs.type_ == rhs.type_], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + } +} + +impl<'de> crate::serde::Deserialize<'de> for APIServiceStatus { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_conditions, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "conditions" => Field::Key_conditions, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = APIServiceStatus; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("APIServiceStatus") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_conditions: Option> = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(APIServiceStatus { + conditions: value_conditions, + }) + } + } + + deserializer.deserialize_struct( + "APIServiceStatus", + &[ + "conditions", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for APIServiceStatus { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "APIServiceStatus", + self.conditions.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.conditions { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for APIServiceStatus { + fn schema_name() -> String { + "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceStatus".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("APIServiceStatus contains derived information about an API server".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "conditions".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Current service state of apiService.".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))), + array: Some(Box::new(crate::schemars::schema::ArrayValidation { + items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::()))), + ..Default::default() + })), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs new file mode 100644 index 000000000..57d836af4 --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/mod.rs @@ -0,0 +1,15 @@ + +mod api_service; +pub use self::api_service::APIService; + +mod api_service_condition; +pub use self::api_service_condition::APIServiceCondition; + +mod api_service_spec; +pub use self::api_service_spec::APIServiceSpec; + +mod api_service_status; +pub use self::api_service_status::APIServiceStatus; + +mod service_reference; +pub use self::service_reference::ServiceReference; diff --git a/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/service_reference.rs b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/service_reference.rs new file mode 100644 index 000000000..b528db4a9 --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/apiregistration/v1/service_reference.rs @@ -0,0 +1,178 @@ +// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.ServiceReference + +/// ServiceReference holds a reference to Service.legacy.k8s.io +#[derive(Clone, Debug, Default, PartialEq)] +pub struct ServiceReference { + /// Name is the name of the service + pub name: Option, + + /// Namespace is the namespace of the service + pub namespace: Option, + + /// If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + pub port: Option, +} + +impl crate::DeepMerge for ServiceReference { + fn merge_from(&mut self, other: Self) { + crate::DeepMerge::merge_from(&mut self.name, other.name); + crate::DeepMerge::merge_from(&mut self.namespace, other.namespace); + crate::DeepMerge::merge_from(&mut self.port, other.port); + } +} + +impl<'de> crate::serde::Deserialize<'de> for ServiceReference { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_name, + Key_namespace, + Key_port, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "name" => Field::Key_name, + "namespace" => Field::Key_namespace, + "port" => Field::Key_port, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = ServiceReference; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("ServiceReference") + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_name: Option = None; + let mut value_namespace: Option = None; + let mut value_port: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_namespace => value_namespace = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_port => value_port = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(ServiceReference { + name: value_name, + namespace: value_namespace, + port: value_port, + }) + } + } + + deserializer.deserialize_struct( + "ServiceReference", + &[ + "name", + "namespace", + "port", + ], + Visitor, + ) + } +} + +impl crate::serde::Serialize for ServiceReference { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + "ServiceReference", + self.name.as_ref().map_or(0, |_| 1) + + self.namespace.as_ref().map_or(0, |_| 1) + + self.port.as_ref().map_or(0, |_| 1), + )?; + if let Some(value) = &self.name { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?; + } + if let Some(value) = &self.namespace { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "namespace", value)?; + } + if let Some(value) = &self.port { + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "port", value)?; + } + crate::serde::ser::SerializeStruct::end(state) + } +} + +#[cfg(feature = "schemars")] +impl crate::schemars::JsonSchema for ServiceReference { + fn schema_name() -> String { + "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.ServiceReference".to_owned() + } + + fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema { + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("ServiceReference holds a reference to Service.legacy.k8s.io".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))), + object: Some(Box::new(crate::schemars::schema::ObjectValidation { + properties: [ + ( + "name".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Name is the name of the service".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "namespace".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("Namespace is the namespace of the service".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))), + ..Default::default() + }), + ), + ( + "port".to_owned(), + crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject { + metadata: Some(Box::new(crate::schemars::schema::Metadata { + description: Some("If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive).".to_owned()), + ..Default::default() + })), + instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))), + format: Some("int32".to_owned()), + ..Default::default() + }), + ), + ].into(), + ..Default::default() + })), + ..Default::default() + }) + } +} diff --git a/src/v1_30/kube_aggregator/pkg/apis/mod.rs b/src/v1_30/kube_aggregator/pkg/apis/mod.rs new file mode 100644 index 000000000..fb7673a7a --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/apis/mod.rs @@ -0,0 +1 @@ +pub mod apiregistration; diff --git a/src/v1_30/kube_aggregator/pkg/mod.rs b/src/v1_30/kube_aggregator/pkg/mod.rs new file mode 100644 index 000000000..42354b599 --- /dev/null +++ b/src/v1_30/kube_aggregator/pkg/mod.rs @@ -0,0 +1 @@ +pub mod apis; diff --git a/src/v1_30/list.rs b/src/v1_30/list.rs new file mode 100644 index 000000000..9863ef185 --- /dev/null +++ b/src/v1_30/list.rs @@ -0,0 +1,150 @@ +// Generated from definition io.k8s.List + +/// List is a list of resources. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct List where T: crate::ListableResource { + /// List of objects. + pub items: Vec, + + /// Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + pub metadata: crate::apimachinery::pkg::apis::meta::v1::ListMeta, +} + +impl crate::Resource for List where T: crate::ListableResource { + const API_VERSION: &'static str = ::API_VERSION; + const GROUP: &'static str = ::GROUP; + const KIND: &'static str = ::LIST_KIND; + const VERSION: &'static str = ::VERSION; + const URL_PATH_SEGMENT: &'static str = ""; + type Scope = ::Scope; +} + +impl crate::Metadata for List where T: crate::ListableResource { + type Ty = crate::apimachinery::pkg::apis::meta::v1::ListMeta; + + fn metadata(&self) -> &::Ty { + &self.metadata + } + + fn metadata_mut(&mut self) -> &mut::Ty { + &mut self.metadata + } +} + +impl crate::DeepMerge for List where T: crate::DeepMerge + crate::Metadata + crate::ListableResource { + fn merge_from(&mut self, other: Self) { + crate::merge_strategies::list::map( + &mut self.items, + other.items, + &[|lhs, rhs| lhs.metadata().namespace == rhs.metadata().namespace, |lhs, rhs| lhs.metadata().name == rhs.metadata().name], + |current_item, other_item| { + crate::DeepMerge::merge_from(current_item, other_item); + }, + ); + crate::DeepMerge::merge_from(&mut self.metadata, other.metadata); + } +} + +impl<'de, T> crate::serde::Deserialize<'de> for List where T: crate::serde::Deserialize<'de> + crate::ListableResource { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + #[allow(non_camel_case_types)] + enum Field { + Key_api_version, + Key_kind, + Key_items, + Key_metadata, + Other, + } + + impl<'de> crate::serde::Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result where D: crate::serde::Deserializer<'de> { + struct Visitor; + + impl<'de> crate::serde::de::Visitor<'de> for Visitor { + type Value = Field; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("field identifier") + } + + fn visit_str(self, v: &str) -> Result where E: crate::serde::de::Error { + Ok(match v { + "apiVersion" => Field::Key_api_version, + "kind" => Field::Key_kind, + "items" => Field::Key_items, + "metadata" => Field::Key_metadata, + _ => Field::Other, + }) + } + } + + deserializer.deserialize_identifier(Visitor) + } + } + + struct Visitor(std::marker::PhantomData); + + impl<'de, T> crate::serde::de::Visitor<'de> for Visitor where T: crate::serde::Deserialize<'de> + crate::ListableResource { + type Value = List; + + fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(::KIND) + } + + fn visit_map(self, mut map: A) -> Result where A: crate::serde::de::MapAccess<'de> { + let mut value_items: Option> = None; + let mut value_metadata: Option = None; + + while let Some(key) = crate::serde::de::MapAccess::next_key::(&mut map)? { + match key { + Field::Key_api_version => { + let value_api_version: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_api_version != ::API_VERSION { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &::API_VERSION)); + } + }, + Field::Key_kind => { + let value_kind: String = crate::serde::de::MapAccess::next_value(&mut map)?; + if value_kind != ::KIND { + return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &::KIND)); + } + }, + Field::Key_items => value_items = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?, + Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; }, + } + } + + Ok(List { + items: value_items.unwrap_or_default(), + metadata: value_metadata.unwrap_or_default(), + }) + } + } + + deserializer.deserialize_struct( + ::KIND, + &[ + "apiVersion", + "kind", + "items", + "metadata", + ], + Visitor(Default::default()), + ) + } +} + +impl crate::serde::Serialize for List where T: crate::serde::Serialize + crate::ListableResource { + fn serialize(&self, serializer: S) -> Result where S: crate::serde::Serializer { + let mut state = serializer.serialize_struct( + ::KIND, + 4, + )?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", ::API_VERSION)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", ::KIND)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "items", &self.items)?; + crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?; + crate::serde::ser::SerializeStruct::end(state) + } +} diff --git a/src/v1_30/mod.rs b/src/v1_30/mod.rs new file mode 100644 index 000000000..27088faf3 --- /dev/null +++ b/src/v1_30/mod.rs @@ -0,0 +1,11 @@ + +mod list; +pub use self::list::List; + +pub mod api; + +pub mod apiextensions_apiserver; + +pub mod apimachinery; + +pub mod kube_aggregator; diff --git a/test.sh b/test.sh index 0cff5b51a..0c8e088c3 100755 --- a/test.sh +++ b/test.sh @@ -44,6 +44,7 @@ declare -A K8S_VERSIONS=( ['1.27']='1.27.13' ['1.28']='1.28.9' ['1.29']='1.29.4' + ['1.30']='1.30.0' ) # https://github.com/kubernetes-sigs/kind/releases @@ -54,6 +55,7 @@ declare -A KIND_VERSIONS=( ['1.27']='0.22.0' ['1.28']='0.22.0' ['1.29']='0.22.0' + ['1.30']='0.22.0' ) case "$1" in